* feat: link email to participatn * fix: bugs * refactor: improve code * refactor: prevent repload * chore: remove unued * fix: type * refactor * fix: type * feat: restrict host * feat: type * feat: tests * fix: don't allow guest * fix: merk guest * fix: bugs * fix: test * fix: test * refactor: feedback * fix: tests --------- Co-authored-by: Volnei Munhoz <volnei.munhoz@gmail.com>
84 lines
3.8 KiB
TypeScript
84 lines
3.8 KiB
TypeScript
import prisma from "@calcom/prisma";
|
|
|
|
export class CalVideoSettingsRepository {
|
|
static async deleteCalVideoSettings(eventTypeId: number) {
|
|
return await prisma.calVideoSettings.delete({
|
|
where: { eventTypeId },
|
|
});
|
|
}
|
|
|
|
static async createCalVideoSettings({
|
|
eventTypeId,
|
|
calVideoSettings,
|
|
}: {
|
|
eventTypeId: number;
|
|
calVideoSettings: {
|
|
disableRecordingForGuests?: boolean | null;
|
|
disableRecordingForOrganizer?: boolean | null;
|
|
enableAutomaticTranscription?: boolean | null;
|
|
enableAutomaticRecordingForOrganizer?: boolean | null;
|
|
disableTranscriptionForGuests?: boolean | null;
|
|
disableTranscriptionForOrganizer?: boolean | null;
|
|
redirectUrlOnExit?: string | null;
|
|
requireEmailForGuests?: boolean | null;
|
|
};
|
|
}) {
|
|
return await prisma.calVideoSettings.create({
|
|
data: {
|
|
disableRecordingForGuests: calVideoSettings.disableRecordingForGuests ?? false,
|
|
disableRecordingForOrganizer: calVideoSettings.disableRecordingForOrganizer ?? false,
|
|
enableAutomaticTranscription: calVideoSettings.enableAutomaticTranscription ?? false,
|
|
enableAutomaticRecordingForOrganizer: calVideoSettings.enableAutomaticRecordingForOrganizer ?? false,
|
|
disableTranscriptionForGuests: calVideoSettings.disableTranscriptionForGuests ?? false,
|
|
disableTranscriptionForOrganizer: calVideoSettings.disableTranscriptionForOrganizer ?? false,
|
|
redirectUrlOnExit: calVideoSettings.redirectUrlOnExit ?? null,
|
|
requireEmailForGuests: calVideoSettings.requireEmailForGuests ?? false,
|
|
eventTypeId,
|
|
},
|
|
});
|
|
}
|
|
|
|
static async createOrUpdateCalVideoSettings({
|
|
eventTypeId,
|
|
calVideoSettings,
|
|
}: {
|
|
eventTypeId: number;
|
|
calVideoSettings: {
|
|
disableRecordingForGuests?: boolean | null;
|
|
disableRecordingForOrganizer?: boolean | null;
|
|
disableTranscriptionForGuests?: boolean | null;
|
|
disableTranscriptionForOrganizer?: boolean | null;
|
|
enableAutomaticTranscription?: boolean | null;
|
|
enableAutomaticRecordingForOrganizer?: boolean | null;
|
|
redirectUrlOnExit?: string | null;
|
|
requireEmailForGuests?: boolean | null;
|
|
};
|
|
}) {
|
|
return await prisma.calVideoSettings.upsert({
|
|
where: { eventTypeId },
|
|
update: {
|
|
disableRecordingForGuests: calVideoSettings.disableRecordingForGuests ?? false,
|
|
disableRecordingForOrganizer: calVideoSettings.disableRecordingForOrganizer ?? false,
|
|
enableAutomaticTranscription: calVideoSettings.enableAutomaticTranscription ?? false,
|
|
enableAutomaticRecordingForOrganizer: calVideoSettings.enableAutomaticRecordingForOrganizer ?? false,
|
|
disableTranscriptionForGuests: calVideoSettings.disableTranscriptionForGuests ?? false,
|
|
disableTranscriptionForOrganizer: calVideoSettings.disableTranscriptionForOrganizer ?? false,
|
|
redirectUrlOnExit: calVideoSettings.redirectUrlOnExit ?? null,
|
|
requireEmailForGuests: calVideoSettings.requireEmailForGuests ?? false,
|
|
updatedAt: new Date(),
|
|
},
|
|
create: {
|
|
disableRecordingForGuests: calVideoSettings.disableRecordingForGuests ?? false,
|
|
disableRecordingForOrganizer: calVideoSettings.disableRecordingForOrganizer ?? false,
|
|
enableAutomaticTranscription: calVideoSettings.enableAutomaticTranscription ?? false,
|
|
enableAutomaticRecordingForOrganizer: calVideoSettings.enableAutomaticRecordingForOrganizer ?? false,
|
|
disableTranscriptionForGuests: calVideoSettings.disableTranscriptionForGuests ?? false,
|
|
disableTranscriptionForOrganizer: calVideoSettings.disableTranscriptionForOrganizer ?? false,
|
|
redirectUrlOnExit: calVideoSettings.redirectUrlOnExit ?? null,
|
|
requireEmailForGuests: calVideoSettings.requireEmailForGuests ?? false,
|
|
eventTypeId,
|
|
},
|
|
});
|
|
}
|
|
}
|