* Init * Add mock trpc context * Intro mockDatabaseClient * Introduce mockDatabaseClient class * Add delete video app test * Add calendar test * Remove unused func from bookingScenario * Remove console.log * Add app repository * Add createMany method to event type repository * Remove instance of MockDatabaseClient from video test * Add destination calendar repository * Remove instances of MockDatabaseClient * abstract logic to own handler * Remove dev dependency * Clean up * Type fix * Pull yarn.lock from main --------- Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
28 lines
605 B
TypeScript
28 lines
605 B
TypeScript
import type { Prisma } from "@prisma/client";
|
|
|
|
import { prisma } from "@calcom/prisma";
|
|
|
|
export class DestinationCalendarRepository {
|
|
static async create(data: Prisma.DestinationCalendarCreateInput) {
|
|
return await prisma.destinationCalendar.create({
|
|
data,
|
|
});
|
|
}
|
|
|
|
static async getByUserId(userId: string) {
|
|
return await prisma.destinationCalendar.findFirst({
|
|
where: {
|
|
userId,
|
|
},
|
|
});
|
|
}
|
|
|
|
static async getByEventTypeId(eventTypeId: number) {
|
|
return await prisma.destinationCalendar.findFirst({
|
|
where: {
|
|
eventTypeId,
|
|
},
|
|
});
|
|
}
|
|
}
|