mirror of
https://github.com/hanzoai/calendar.git
synced 2026-10-30 14:46:43 +00:00
<!-- This is an auto-generated description by cubic. --> ## Summary by cubic Switch @calcom/prisma to use relative imports for client and enums. This removes self-references, stabilizes builds, and improves type resolution. - **Refactors** - Replaced imports from "@calcom/prisma/*" with local "./client" and "./enums" across extensions, selects, mocks, and availability check. - Updated safeJSONStringify parameter type from any to unknown. - Minor formatting cleanup in zod-utils. <sup>Written for commit 85c0a7b75fb1291be5b848a73d1ccb5543283f49. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import { Prisma } from "../client";
|
|
|
|
export function excludePendingPaymentsExtension() {
|
|
return Prisma.defineExtension({
|
|
query: {
|
|
team: {
|
|
async findUnique({ args, query }) {
|
|
return excludePendingPayments(args, query);
|
|
},
|
|
async findFirst({ args, query }) {
|
|
return excludePendingPayments(args, query);
|
|
},
|
|
async findMany({ args, query }) {
|
|
return excludePendingPayments(args, query);
|
|
},
|
|
async findUniqueOrThrow({ args, query }) {
|
|
return excludePendingPayments(args, query);
|
|
},
|
|
async findFirstOrThrow({ args, query }) {
|
|
return excludePendingPayments(args, query);
|
|
},
|
|
},
|
|
},
|
|
});
|
|
}
|
|
|
|
async function excludePendingPayments(
|
|
args:
|
|
| Prisma.TeamFindUniqueArgs
|
|
| Prisma.TeamFindFirstArgs
|
|
| Prisma.TeamFindManyArgs
|
|
| Prisma.TeamFindUniqueOrThrowArgs
|
|
| Prisma.TeamFindFirstOrThrowArgs,
|
|
query: <T>(args: T) => Promise<unknown>
|
|
) {
|
|
args.where = args.where || {};
|
|
if (args.where.pendingPayment === undefined) {
|
|
args.where.pendingPayment = false;
|
|
}
|
|
return query(args);
|
|
}
|