Availabilty consolitadion (#3010)

This commit is contained in:
Omar López authored and GitHub committed 2022-06-10 12:38:46 -06:00
1 parent 1f1e364a30
commit 22d2bae46b
28 files changed
+553 -519

No files matched your search

+1
View File
@@ -1,2 +1,3 @@
export * from "./booking";
export * from "./event-types";
export * from "./user";
+52
View File
@@ -0,0 +1,52 @@
import { Prisma } from "@prisma/client";
export const availabilityUserSelect = Prisma.validator<Prisma.UserSelect>()({
credentials: true,
timeZone: true,
bufferTime: true,
availability: true,
id: true,
startTime: true,
endTime: true,
selectedCalendars: true,
schedules: {
select: {
availability: true,
timeZone: true,
id: true,
},
},
defaultScheduleId: true,
});
export const baseUserSelect = Prisma.validator<Prisma.UserSelect>()({
email: true,
name: true,
username: true,
destinationCalendar: true,
locale: true,
plan: true,
avatar: true,
hideBranding: true,
theme: true,
brandColor: true,
darkBrandColor: true,
...availabilityUserSelect,
});
export const userSelect = Prisma.validator<Prisma.UserArgs>()({
select: {
email: true,
name: true,
username: true,
destinationCalendar: true,
locale: true,
plan: true,
avatar: true,
hideBranding: true,
theme: true,
brandColor: true,
darkBrandColor: true,
...availabilityUserSelect,
},
});
+36
View File
@@ -56,3 +56,39 @@ export const stringOrNumber = z.union([
]);
export const stringToDayjs = z.string().transform((val) => dayjs(val));
export const bookingCreateBodySchema = z.object({
email: z.string(),
end: z.string(),
web3Details: z
.object({
userWallet: z.string(),
userSignature: z.string(),
})
.optional(),
eventTypeId: z.number(),
eventTypeSlug: z.string(),
guests: z.array(z.string()).optional(),
location: z.string(),
name: z.string(),
notes: z.string().optional(),
rescheduleUid: z.string().optional(),
recurringEventId: z.string().optional(),
start: z.string(),
timeZone: z.string(),
user: z.union([z.string(), z.array(z.string())]).optional(),
language: z.string(),
bookingUid: z.string().optional(),
customInputs: z.array(z.object({ label: z.string(), value: z.union([z.string(), z.boolean()]) })),
metadata: z.record(z.string()),
hasHashedBookingLink: z.boolean(),
hashedLink: z.string().nullish(),
});
export const extendedBookingCreateBody = bookingCreateBodySchema.merge(
z.object({
noEmail: z.boolean().optional(),
recurringCount: z.number().optional(),
rescheduleReason: z.string().optional(),
})
);