mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
chore: add monorepo tools (#9196)
This commit is contained in:
@@ -53,16 +53,22 @@ const cloudUserSchema = z.object({
|
||||
export const runPrisma = async <T>(
|
||||
cb: (
|
||||
prisma: InstanceType<
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||
// oxlint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||
typeof import('../../../packages/backend/server/node_modules/@prisma/client').PrismaClient
|
||||
>
|
||||
) => Promise<T>
|
||||
): Promise<T> => {
|
||||
const {
|
||||
PrismaClient,
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
} = require('../../../packages/backend/server/node_modules/@prisma/client');
|
||||
const client = new PrismaClient();
|
||||
// oxlint-disable-next-line @typescript-eslint/consistent-type-imports
|
||||
} = await import(
|
||||
'../../../packages/backend/server/node_modules/@prisma/client'
|
||||
);
|
||||
const client = new PrismaClient({
|
||||
datasourceUrl:
|
||||
process.env.DATABASE_URL ||
|
||||
'postgresql://affine:affine@localhost:5432/affine',
|
||||
});
|
||||
await client.$connect();
|
||||
try {
|
||||
return await cb(client);
|
||||
|
||||
Reference in New Issue
Block a user