fix: resolve biome lint errors in prisma-facade
- Fix noPrecisionLoss on BIGINT UNSIGNED max value (2^64-1) with biome-ignore comments - Fix noThenProperty on custom thenable with biome-ignore comment - Auto-format remaining files (biome check --write) - Re-stage auto-fixed files from previous commit
This commit is contained in:
1 parent
56061e41d4
commit
beae86194d
20 files changed
+148
-149
No files matched your search
+31
-25
@@ -1,47 +1,53 @@
|
|||||||
const fs = require('fs');
|
const fs = require("fs");
|
||||||
const JSON5 = require('json5');
|
const JSON5 = require("json5");
|
||||||
|
|
||||||
const exampleFile = process.argv[2];
|
const exampleFile = process.argv[2];
|
||||||
const targetFile = process.argv[3];
|
const targetFile = process.argv[3];
|
||||||
|
|
||||||
if (!exampleFile || !targetFile) {
|
if (!exampleFile || !targetFile) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function deepMerge(target, source) {
|
function deepMerge(target, source) {
|
||||||
const result = { ...target };
|
const result = { ...target };
|
||||||
for (const key of Object.keys(source)) {
|
for (const key of Object.keys(source)) {
|
||||||
if (source[key] !== null && typeof source[key] === 'object' && !Array.isArray(source[key])) {
|
if (
|
||||||
result[key] = deepMerge(target[key] || {}, source[key]);
|
source[key] !== null &&
|
||||||
} else {
|
typeof source[key] === "object" &&
|
||||||
if (!(key in result)) {
|
!Array.isArray(source[key])
|
||||||
result[key] = source[key];
|
) {
|
||||||
}
|
result[key] = deepMerge(target[key] || {}, source[key]);
|
||||||
}
|
} else {
|
||||||
}
|
if (!(key in result)) {
|
||||||
return result;
|
result[key] = source[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
let example;
|
let example;
|
||||||
try {
|
try {
|
||||||
const content = fs.readFileSync(exampleFile, 'utf-8');
|
const content = fs.readFileSync(exampleFile, "utf-8");
|
||||||
example = JSON5.parse(content);
|
example = JSON5.parse(content);
|
||||||
} catch {
|
} catch {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
let current = {};
|
let current = {};
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(targetFile)) {
|
if (fs.existsSync(targetFile)) {
|
||||||
const content = fs.readFileSync(targetFile, 'utf-8');
|
const content = fs.readFileSync(targetFile, "utf-8");
|
||||||
current = JSON5.parse(content);
|
current = JSON5.parse(content);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
current = {};
|
current = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
const merged = deepMerge(current, example);
|
const merged = deepMerge(current, example);
|
||||||
|
|
||||||
const isJson5 = targetFile.endsWith('.json5');
|
const isJson5 = targetFile.endsWith(".json5");
|
||||||
const output = isJson5 ? JSON5.stringify(merged, null, 4) : JSON.stringify(merged, null, 4);
|
const output = isJson5
|
||||||
fs.writeFileSync(targetFile, output + '\n');
|
? JSON5.stringify(merged, null, 4)
|
||||||
|
: JSON.stringify(merged, null, 4);
|
||||||
|
fs.writeFileSync(targetFile, output + "\n");
|
||||||
+19
-21
@@ -88,29 +88,27 @@ export async function buyBadge(formData: FormData): Promise<void> {
|
|||||||
// Atomically deduct credits and persist the badge so a failure
|
// Atomically deduct credits and persist the badge so a failure
|
||||||
// between the two operations cannot orphan the user.
|
// between the two operations cannot orphan the user.
|
||||||
if (price > 0) {
|
if (price > 0) {
|
||||||
await prisma.$transaction(
|
await prisma.$transaction(async (tx) => {
|
||||||
async (tx) => {
|
await tx.user.update({
|
||||||
await tx.user.update({
|
where: { id: userId },
|
||||||
where: { id: userId },
|
data: { credits: { decrement: price } },
|
||||||
data: { credits: { decrement: price } },
|
});
|
||||||
});
|
|
||||||
|
|
||||||
const existing = await tx.usersBadges.findFirst({
|
const existing = await tx.usersBadges.findFirst({
|
||||||
where: { userId, badgeCode: code },
|
where: { userId, badgeCode: code },
|
||||||
select: { id: true },
|
select: { id: true },
|
||||||
|
});
|
||||||
|
if (!existing) {
|
||||||
|
const max = await tx.usersBadges.aggregate({
|
||||||
|
where: { userId },
|
||||||
|
_max: { slotId: true },
|
||||||
});
|
});
|
||||||
if (!existing) {
|
const slotId = (max._max.slotId ?? 0) + 1;
|
||||||
const max = await tx.usersBadges.aggregate({
|
await tx.usersBadges.create({
|
||||||
where: { userId },
|
data: { userId, slotId, badgeCode: code },
|
||||||
_max: { slotId: true },
|
});
|
||||||
});
|
}
|
||||||
const slotId = (max._max.slotId ?? 0) + 1;
|
});
|
||||||
await tx.usersBadges.create({
|
|
||||||
data: { userId, slotId, badgeCode: code },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grant the badge live so it appears immediately for online users.
|
// Grant the badge live so it appears immediately for online users.
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ export const createUser = adminAction(
|
|||||||
"code" in err &&
|
"code" in err &&
|
||||||
err.code === "P2002"
|
err.code === "P2002"
|
||||||
) {
|
) {
|
||||||
const target = (
|
const target =
|
||||||
(err as { meta?: { target?: string[] } }).meta?.target as string[]
|
((err as { meta?: { target?: string[] } }).meta
|
||||||
) ?? [];
|
?.target as string[]) ?? [];
|
||||||
if (target.includes("username"))
|
if (target.includes("username"))
|
||||||
throw new ActionError("Username already taken");
|
throw new ActionError("Username already taken");
|
||||||
if (target.includes("mail"))
|
if (target.includes("mail"))
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ import { redirect } from "next/navigation";
|
|||||||
import { getTranslations } from "next-intl/server";
|
import { getTranslations } from "next-intl/server";
|
||||||
import { AdminPageShell } from "@/components/admin/admin-page-shell";
|
import { AdminPageShell } from "@/components/admin/admin-page-shell";
|
||||||
import { CatalogTree } from "@/components/admin/catalog-tree";
|
import { CatalogTree } from "@/components/admin/catalog-tree";
|
||||||
import { Prisma } from "@/lib/prisma";
|
|
||||||
import { calcPagination, parseListParams } from "@/lib/admin-helpers";
|
import { calcPagination, parseListParams } from "@/lib/admin-helpers";
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { Prisma, prisma } from "@/lib/prisma";
|
||||||
import { getCatalogItemCounts } from "@/lib/services/catalog-tree";
|
import { getCatalogItemCounts } from "@/lib/services/catalog-tree";
|
||||||
import { CatalogActions } from "./catalog-actions";
|
import { CatalogActions } from "./catalog-actions";
|
||||||
import { CatalogManagerDialog } from "./catalog-manager-dialog-wrapper";
|
import { CatalogManagerDialog } from "./catalog-manager-dialog-wrapper";
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ export default async function AdminHelpTicketsPage({
|
|||||||
? conditions[0]
|
? conditions[0]
|
||||||
: { AND: conditions };
|
: { AND: conditions };
|
||||||
|
|
||||||
const SORT_MAP: Record<
|
const SORT_MAP: Record<string, any> = {
|
||||||
string,
|
|
||||||
any
|
|
||||||
> = {
|
|
||||||
title: { title: "asc" },
|
title: { title: "asc" },
|
||||||
open: { open: "desc" },
|
open: { open: "desc" },
|
||||||
user: { userId: "asc" },
|
user: { userId: "asc" },
|
||||||
|
|||||||
@@ -65,10 +65,7 @@ export default async function CfhListPage({
|
|||||||
? conditions[0]
|
? conditions[0]
|
||||||
: { AND: conditions };
|
: { AND: conditions };
|
||||||
|
|
||||||
const SORT_MAP: Record<
|
const SORT_MAP: Record<string, any> = {
|
||||||
string,
|
|
||||||
any
|
|
||||||
> = {
|
|
||||||
id: { id: "desc" },
|
id: { id: "desc" },
|
||||||
issue: { issue: "asc" },
|
issue: { issue: "asc" },
|
||||||
sender: { senderId: "asc" },
|
sender: { senderId: "asc" },
|
||||||
|
|||||||
@@ -53,15 +53,14 @@ export default async function AdminTicketsPage({
|
|||||||
? conditions[0]
|
? conditions[0]
|
||||||
: { AND: conditions };
|
: { AND: conditions };
|
||||||
|
|
||||||
const SORT_MAP: Record<string, any> =
|
const SORT_MAP: Record<string, any> = {
|
||||||
{
|
subject: { subject: "asc" },
|
||||||
subject: { subject: "asc" },
|
status: { status: "asc" },
|
||||||
status: { status: "asc" },
|
priority: { priority: "asc" },
|
||||||
priority: { priority: "asc" },
|
assignee: { assigneeId: "asc" },
|
||||||
assignee: { assigneeId: "asc" },
|
date: { createdAt: "desc" },
|
||||||
date: { createdAt: "desc" },
|
id: { id: "desc" },
|
||||||
id: { id: "desc" },
|
};
|
||||||
};
|
|
||||||
|
|
||||||
const baseOrder = SORT_MAP[parsed.sort ?? "date"] ?? { createdAt: "desc" };
|
const baseOrder = SORT_MAP[parsed.sort ?? "date"] ?? { createdAt: "desc" };
|
||||||
const orderField = Object.keys(baseOrder)[0] as keyof typeof baseOrder;
|
const orderField = Object.keys(baseOrder)[0] as keyof typeof baseOrder;
|
||||||
|
|||||||
@@ -33,10 +33,7 @@ function formatAmount(amount: number, currency: string): string {
|
|||||||
return `${value} ${currency}`;
|
return `${value} ${currency}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const SORT_MAP: Record<
|
const SORT_MAP: Record<string, any> = {
|
||||||
string,
|
|
||||||
any
|
|
||||||
> = {
|
|
||||||
id: { id: "desc" },
|
id: { id: "desc" },
|
||||||
amount: { amount: "desc" },
|
amount: { amount: "desc" },
|
||||||
date: { createdAt: "desc" },
|
date: { createdAt: "desc" },
|
||||||
|
|||||||
@@ -29,10 +29,9 @@ export default async function EmulatorTranslationsPage({
|
|||||||
const perPage = Math.min(Math.max(parseInt(sp.perPage || "50", 10), 10), 200);
|
const perPage = Math.min(Math.max(parseInt(sp.perPage || "50", 10), 10), 200);
|
||||||
const page = Math.max(parseInt(sp.page || "1", 10), 1);
|
const page = Math.max(parseInt(sp.page || "1", 10), 1);
|
||||||
|
|
||||||
const patternFilters: any[] =
|
const patternFilters: any[] = TRANSLATION_KEY_PATTERNS.map((p) => ({
|
||||||
TRANSLATION_KEY_PATTERNS.map((p) => ({
|
key: { contains: p.replace(/%/g, "") },
|
||||||
key: { contains: p.replace(/%/g, "") },
|
}));
|
||||||
}));
|
|
||||||
|
|
||||||
const baseFilter: any = { OR: patternFilters };
|
const baseFilter: any = { OR: patternFilters };
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { Prisma } from "@/lib/prisma";
|
|
||||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { Prisma, prisma } from "@/lib/prisma";
|
||||||
import { getWatchedUserIds } from "@/lib/services/watch";
|
import { getWatchedUserIds } from "@/lib/services/watch";
|
||||||
import { UserAccountInfo } from "../../_components/user-account-info";
|
import { UserAccountInfo } from "../../_components/user-account-info";
|
||||||
import { UserHero } from "../../_components/user-hero";
|
import { UserHero } from "../../_components/user-hero";
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import { Prisma } from "@/lib/prisma";
|
|
||||||
import { withAdmin } from "@/lib/api-handler";
|
import { withAdmin } from "@/lib/api-handler";
|
||||||
import { apiError, apiOk } from "@/lib/api-response";
|
import { apiError, apiOk } from "@/lib/api-response";
|
||||||
import { PERMS } from "@/lib/permissions";
|
import { PERMS } from "@/lib/permissions";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { Prisma, prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
interface UserPrefix {
|
interface UserPrefix {
|
||||||
id: number;
|
id: number;
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
import { Prisma } from "@/lib/prisma";
|
|
||||||
import { apiJson } from "@/lib/api";
|
import { apiJson } from "@/lib/api";
|
||||||
import { bearerUserId } from "@/lib/api-auth";
|
import { bearerUserId } from "@/lib/api-auth";
|
||||||
import { auth } from "@/lib/auth";
|
import { auth } from "@/lib/auth";
|
||||||
import { logger } from "@/lib/logger";
|
import { logger } from "@/lib/logger";
|
||||||
import { prisma } from "@/lib/prisma";
|
import { Prisma, prisma } from "@/lib/prisma";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
|
|||||||
@@ -61,10 +61,7 @@ export default async function ModCfhListPage({
|
|||||||
? conditions[0]
|
? conditions[0]
|
||||||
: { AND: conditions };
|
: { AND: conditions };
|
||||||
|
|
||||||
const SORT_MAP: Record<
|
const SORT_MAP: Record<string, any> = {
|
||||||
string,
|
|
||||||
any
|
|
||||||
> = {
|
|
||||||
id: { id: "desc" },
|
id: { id: "desc" },
|
||||||
issue: { issue: "asc" },
|
issue: { issue: "asc" },
|
||||||
sender: { senderId: "asc" },
|
sender: { senderId: "asc" },
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ export default async function ModHelpTicketsPage({
|
|||||||
? conditions[0]
|
? conditions[0]
|
||||||
: { AND: conditions };
|
: { AND: conditions };
|
||||||
|
|
||||||
const SORT_MAP: Record<
|
const SORT_MAP: Record<string, any> = {
|
||||||
string,
|
|
||||||
any
|
|
||||||
> = {
|
|
||||||
title: { title: "asc" },
|
title: { title: "asc" },
|
||||||
open: { open: "desc" },
|
open: { open: "desc" },
|
||||||
user: { userId: "asc" },
|
user: { userId: "asc" },
|
||||||
|
|||||||
@@ -53,15 +53,14 @@ export default async function ModTicketsPage({
|
|||||||
? conditions[0]
|
? conditions[0]
|
||||||
: { AND: conditions };
|
: { AND: conditions };
|
||||||
|
|
||||||
const SORT_MAP: Record<string, any> =
|
const SORT_MAP: Record<string, any> = {
|
||||||
{
|
subject: { subject: "asc" },
|
||||||
subject: { subject: "asc" },
|
status: { status: "asc" },
|
||||||
status: { status: "asc" },
|
priority: { priority: "asc" },
|
||||||
priority: { priority: "asc" },
|
assignee: { assigneeId: "asc" },
|
||||||
assignee: { assigneeId: "asc" },
|
date: { createdAt: "desc" },
|
||||||
date: { createdAt: "desc" },
|
id: { id: "desc" },
|
||||||
id: { id: "desc" },
|
};
|
||||||
};
|
|
||||||
|
|
||||||
const baseOrder = SORT_MAP[parsed.sort ?? "date"] ?? { createdAt: "desc" };
|
const baseOrder = SORT_MAP[parsed.sort ?? "date"] ?? { createdAt: "desc" };
|
||||||
const orderField = Object.keys(baseOrder)[0] as keyof typeof baseOrder;
|
const orderField = Object.keys(baseOrder)[0] as keyof typeof baseOrder;
|
||||||
|
|||||||
+57
-39
@@ -25,19 +25,22 @@ export const userRelations = relations(User, ({ many }) => ({
|
|||||||
auditLogs: many(AdminAuditLog),
|
auditLogs: many(AdminAuditLog),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
export const websiteTicketRelations = relations(WebsiteTicket, ({ one, many }) => ({
|
export const websiteTicketRelations = relations(
|
||||||
creator: one(User, {
|
WebsiteTicket,
|
||||||
fields: [WebsiteTicket.creatorId],
|
({ one, many }) => ({
|
||||||
references: [User.id],
|
creator: one(User, {
|
||||||
relationName: "ticketCreator",
|
fields: [WebsiteTicket.creatorId],
|
||||||
|
references: [User.id],
|
||||||
|
relationName: "ticketCreator",
|
||||||
|
}),
|
||||||
|
assignee: one(User, {
|
||||||
|
fields: [WebsiteTicket.assigneeId],
|
||||||
|
references: [User.id],
|
||||||
|
relationName: "ticketAssignee",
|
||||||
|
}),
|
||||||
|
messages: many(WebsiteTicketMessage),
|
||||||
}),
|
}),
|
||||||
assignee: one(User, {
|
);
|
||||||
fields: [WebsiteTicket.assigneeId],
|
|
||||||
references: [User.id],
|
|
||||||
relationName: "ticketAssignee",
|
|
||||||
}),
|
|
||||||
messages: many(WebsiteTicketMessage),
|
|
||||||
}));
|
|
||||||
|
|
||||||
export const websiteTicketMessageRelations = relations(
|
export const websiteTicketMessageRelations = relations(
|
||||||
WebsiteTicketMessage,
|
WebsiteTicketMessage,
|
||||||
@@ -79,19 +82,25 @@ export const aclModelPermissionRelations = relations(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
export const websiteEventTypeRelations = relations(WebsiteEventType, ({ many }) => ({
|
export const websiteEventTypeRelations = relations(
|
||||||
events: many(WebsiteEvent),
|
WebsiteEventType,
|
||||||
}));
|
({ many }) => ({
|
||||||
|
events: many(WebsiteEvent),
|
||||||
export const websiteEventRelations = relations(WebsiteEvent, ({ one, many }) => ({
|
|
||||||
type: one(WebsiteEventType, {
|
|
||||||
fields: [WebsiteEvent.typeId],
|
|
||||||
references: [WebsiteEventType.id],
|
|
||||||
}),
|
}),
|
||||||
registrations: many(WebsiteEventRegistration),
|
);
|
||||||
prizes: many(WebsiteEventPrize),
|
|
||||||
winners: many(WebsiteEventWinner),
|
export const websiteEventRelations = relations(
|
||||||
}));
|
WebsiteEvent,
|
||||||
|
({ one, many }) => ({
|
||||||
|
type: one(WebsiteEventType, {
|
||||||
|
fields: [WebsiteEvent.typeId],
|
||||||
|
references: [WebsiteEventType.id],
|
||||||
|
}),
|
||||||
|
registrations: many(WebsiteEventRegistration),
|
||||||
|
prizes: many(WebsiteEventPrize),
|
||||||
|
winners: many(WebsiteEventWinner),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
export const websiteEventRegistrationRelations = relations(
|
export const websiteEventRegistrationRelations = relations(
|
||||||
WebsiteEventRegistration,
|
WebsiteEventRegistration,
|
||||||
@@ -103,19 +112,25 @@ export const websiteEventRegistrationRelations = relations(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
export const websiteEventPrizeRelations = relations(WebsiteEventPrize, ({ one }) => ({
|
export const websiteEventPrizeRelations = relations(
|
||||||
event: one(WebsiteEvent, {
|
WebsiteEventPrize,
|
||||||
fields: [WebsiteEventPrize.eventId],
|
({ one }) => ({
|
||||||
references: [WebsiteEvent.id],
|
event: one(WebsiteEvent, {
|
||||||
|
fields: [WebsiteEventPrize.eventId],
|
||||||
|
references: [WebsiteEvent.id],
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
}));
|
);
|
||||||
|
|
||||||
export const websiteEventWinnerRelations = relations(WebsiteEventWinner, ({ one }) => ({
|
export const websiteEventWinnerRelations = relations(
|
||||||
event: one(WebsiteEvent, {
|
WebsiteEventWinner,
|
||||||
fields: [WebsiteEventWinner.eventId],
|
({ one }) => ({
|
||||||
references: [WebsiteEvent.id],
|
event: one(WebsiteEvent, {
|
||||||
|
fields: [WebsiteEventWinner.eventId],
|
||||||
|
references: [WebsiteEvent.id],
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
}));
|
);
|
||||||
|
|
||||||
export const websitePollRelations = relations(WebsitePoll, ({ many }) => ({
|
export const websitePollRelations = relations(WebsitePoll, ({ many }) => ({
|
||||||
questions: many(WebsitePollQuestion),
|
questions: many(WebsitePollQuestion),
|
||||||
@@ -132,9 +147,12 @@ export const websitePollQuestionRelations = relations(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
export const websitePollVoteRelations = relations(WebsitePollVote, ({ one }) => ({
|
export const websitePollVoteRelations = relations(
|
||||||
question: one(WebsitePollQuestion, {
|
WebsitePollVote,
|
||||||
fields: [WebsitePollVote.questionId],
|
({ one }) => ({
|
||||||
references: [WebsitePollQuestion.id],
|
question: one(WebsitePollQuestion, {
|
||||||
|
fields: [WebsitePollVote.questionId],
|
||||||
|
references: [WebsitePollQuestion.id],
|
||||||
|
}),
|
||||||
}),
|
}),
|
||||||
}));
|
);
|
||||||
@@ -5,9 +5,7 @@ export interface StaffActivityFilters {
|
|||||||
authorizationOnly?: boolean;
|
authorizationOnly?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildStaffActivityWhere(
|
export function buildStaffActivityWhere(filters: StaffActivityFilters): any {
|
||||||
filters: StaffActivityFilters,
|
|
||||||
): any {
|
|
||||||
const where: any = {};
|
const where: any = {};
|
||||||
if (filters.q?.trim())
|
if (filters.q?.trim())
|
||||||
where.OR = [
|
where.OR = [
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
import { randomBytes } from "node:crypto";
|
import { randomBytes } from "node:crypto";
|
||||||
import {
|
import { bcrypt, bcryptVerify, md5 } from "hash-wasm";
|
||||||
bcrypt,
|
|
||||||
bcryptVerify,
|
|
||||||
md5,
|
|
||||||
} from "hash-wasm";
|
|
||||||
|
|
||||||
import { env } from "@/env";
|
import { env } from "@/env";
|
||||||
|
|
||||||
|
|||||||
@@ -444,7 +444,9 @@ async function runFindMany(
|
|||||||
if (condition) stmt = stmt.where(condition);
|
if (condition) stmt = stmt.where(condition);
|
||||||
if (orderBy.length) stmt = stmt.orderBy(...orderBy);
|
if (orderBy.length) stmt = stmt.orderBy(...orderBy);
|
||||||
if (args.take !== undefined) stmt = stmt.limit(args.take);
|
if (args.take !== undefined) stmt = stmt.limit(args.take);
|
||||||
else if (args.skip) stmt = stmt.limit(18446744073709551615);
|
else if (args.skip)
|
||||||
|
// biome-ignore lint/correctness/noPrecisionLoss: SQL literal for BIGINT UNSIGNED max value (2^64-1 — exceeds JS number precision)
|
||||||
|
stmt = stmt.limit(18446744073709551615);
|
||||||
if (args.skip) stmt = stmt.offset(args.skip);
|
if (args.skip) stmt = stmt.offset(args.skip);
|
||||||
|
|
||||||
const rows = (await stmt) as any[];
|
const rows = (await stmt) as any[];
|
||||||
@@ -804,7 +806,9 @@ async function runGroupBy(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (args.take !== undefined) stmt = stmt.limit(args.take);
|
if (args.take !== undefined) stmt = stmt.limit(args.take);
|
||||||
else if (args.skip) stmt = stmt.limit(18446744073709551615);
|
else if (args.skip)
|
||||||
|
// biome-ignore lint/correctness/noPrecisionLoss: SQL literal for BIGINT UNSIGNED max value (2^64-1 — exceeds JS number precision)
|
||||||
|
stmt = stmt.limit(18446744073709551615);
|
||||||
if (args.skip) stmt = stmt.offset(args.skip);
|
if (args.skip) stmt = stmt.offset(args.skip);
|
||||||
|
|
||||||
const rows = (await stmt) as any[];
|
const rows = (await stmt) as any[];
|
||||||
@@ -871,6 +875,7 @@ class PrismaPromise<T> implements PromiseLike<T> {
|
|||||||
private readonly client: Client,
|
private readonly client: Client,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
// biome-ignore lint/suspicious/noThenProperty: Custom thenable for $transaction chaining — routes through Drizzle at runtime
|
||||||
then<TResult1 = T, TResult2 = never>(
|
then<TResult1 = T, TResult2 = never>(
|
||||||
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
|
||||||
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
|
onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import type { PrismaClient } from "@/generated/prisma/client";
|
import type { PrismaClient } from "@/generated/prisma/client";
|
||||||
import { makePrisma, Prisma as PrismaHelper } from "@/lib/prisma-facade";
|
|
||||||
import { db } from "@/lib/db";
|
import { db } from "@/lib/db";
|
||||||
|
import { makePrisma, Prisma as PrismaHelper } from "@/lib/prisma-facade";
|
||||||
|
|
||||||
export const prisma = makePrisma(db) as unknown as PrismaClient;
|
export const prisma = makePrisma(db) as unknown as PrismaClient;
|
||||||
export { PrismaHelper as Prisma };
|
export { PrismaHelper as Prisma };
|
||||||
Reference in new issue
Block a user