* refactor: replace Prisma.validator<Select>() with satisfies syntax
- Convert all Prisma.validator<Prisma.SomeSelect>()({...}) patterns to {...} satisfies Prisma.SomeSelect
- Update import { Prisma } to import type { Prisma } where only used for types
- Maintain existing functionality while modernizing TypeScript syntax
- Covers 89+ files across packages/prisma/selects, repository classes, tRPC handlers, and API modules
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* refactor: complete remaining Prisma.validator conversions
- Update test fixture files with satisfies syntax
- Apply lint-staged formatting fixes
- Complete refactoring of all remaining files
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* revert: remove unintended platform library update
- Revert yarn.lock changes that updated @calcom/platform-libraries from 0.0.236 to 0.0.239
- This was an unintended side effect of the refactoring process
- Keep only the intended Prisma.validator → satisfies syntax changes
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* fix: update ESLint plugin references to correct package name
- Change @calcom/eslint to @calcom/eslint-plugin-eslint in eslint-preset.js
- Resolves 'Failed to load plugin @calcom/eslint' error causing CI failures
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: alex@cal.com <me@alexvanandel.com>
53 lines
1.4 KiB
TypeScript
53 lines
1.4 KiB
TypeScript
import type { Prisma } from "@prisma/client";
|
|
|
|
import { prisma } from "@calcom/prisma";
|
|
import type { PartialReference } from "@calcom/types/EventManager";
|
|
|
|
const bookingReferenceSelect = {
|
|
id: true,
|
|
type: true,
|
|
uid: true,
|
|
meetingId: true,
|
|
meetingUrl: true,
|
|
credentialId: true,
|
|
deleted: true,
|
|
bookingId: true,
|
|
} satisfies Prisma.BookingReferenceSelect;
|
|
|
|
export class BookingReferenceRepository {
|
|
static async findDailyVideoReferenceByRoomName({ roomName }: { roomName: string }) {
|
|
return prisma.bookingReference.findFirst({
|
|
where: { type: "daily_video", uid: roomName, meetingId: roomName, bookingId: { not: null } },
|
|
select: bookingReferenceSelect,
|
|
});
|
|
}
|
|
|
|
/**
|
|
* If rescheduling a booking with new references from the EventManager. Delete the previous references and replace them with new ones
|
|
*/
|
|
static async replaceBookingReferences({
|
|
bookingId,
|
|
newReferencesToCreate,
|
|
}: {
|
|
bookingId: number;
|
|
newReferencesToCreate: PartialReference[];
|
|
}) {
|
|
const newReferenceTypes = newReferencesToCreate.map((reference) => reference.type);
|
|
|
|
await prisma.bookingReference.deleteMany({
|
|
where: {
|
|
bookingId,
|
|
type: {
|
|
in: newReferenceTypes,
|
|
},
|
|
},
|
|
});
|
|
|
|
await prisma.bookingReference.createMany({
|
|
data: newReferencesToCreate.map((reference) => {
|
|
return { ...reference, bookingId };
|
|
}),
|
|
});
|
|
}
|
|
}
|