
* Adds available apps * Adds App Model * WIP * Updates seeder script * Seeder fixes * lowercase categories * Upgrades prisma * WIP * WIP * Hopefully fixes circular deps * Type fixes * Fixes seeder * Adds migration to connect Credentials to Apps * Updates app store callbacks * Updates google credentials * Uses dirName from DB * Type fixes * Update reschedule.ts * Seeder fixes * Fixes categories listing * Update index.ts * Update schema.prisma * Updates dependencies * Renames giphy app * Uses dynamic imports for app metadata * Fixes credentials error * Uses dynamic import for api handlers * Dynamic import fixes * Allows for simple folder names in app store * Squashes app migrations * seeder fixes * Fixes dyamic imports * Update apiHandlers.tsx
31 lines
751 B
TypeScript
31 lines
751 B
TypeScript
import { Prisma, PrismaClient } from "@prisma/client";
|
|
|
|
async function getBooking(prisma: PrismaClient, uid: string) {
|
|
const booking = await prisma.booking.findFirst({
|
|
where: {
|
|
uid,
|
|
},
|
|
select: {
|
|
startTime: true,
|
|
description: true,
|
|
attendees: {
|
|
select: {
|
|
email: true,
|
|
name: true,
|
|
},
|
|
},
|
|
},
|
|
});
|
|
|
|
if (booking) {
|
|
// @NOTE: had to do this because Server side cant return [Object objects]
|
|
// probably fixable with json.stringify -> json.parse
|
|
booking["startTime"] = (booking?.startTime as Date)?.toISOString() as unknown as Date;
|
|
}
|
|
|
|
return booking;
|
|
}
|
|
|
|
export type GetBookingType = Prisma.PromiseReturnType<typeof getBooking>;
|
|
|
|
export default getBooking;
|