chore: rename empty validations, enable relations on user zod object
parent
396c5b8d8c
commit
c561b16f85
|
@ -55,7 +55,7 @@ const schemaAvailability = z
|
|||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
.strict();
|
||||
const withValidAvailability = withValidation({
|
||||
schema: schemaAvailability,
|
||||
type: "Zod",
|
||||
|
|
|
@ -1,65 +1,13 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const schemaBookingReference = z
|
||||
.object({})
|
||||
.strict();
|
||||
const withValidBookingReference = withValidation({
|
||||
schema: schemaBookingReference,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaBookingReference, withValidBookingReference };
|
||||
|
|
|
@ -14,48 +14,8 @@ const schemaBooking = z
|
|||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
.strict();
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
type: "Zod",
|
||||
|
|
|
@ -1,65 +1,13 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const schemaCredential = z
|
||||
.object({})
|
||||
.strict();
|
||||
const withValidCredential = withValidation({
|
||||
schema: schemaCredential,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaCredential, withValidCredential };
|
||||
|
|
|
@ -1,65 +1,13 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const schemaDailyEventReference = z
|
||||
.object({})
|
||||
.strict();
|
||||
const withValidDailyEventReference = withValidation({
|
||||
schema: schemaDailyEventReference,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaDailyEventReference, withValidDailyEventReference };
|
||||
|
|
|
@ -1,65 +1,13 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const schemaDestinationCalendar = z
|
||||
.object({})
|
||||
.strict();
|
||||
const withValidDestinationCalendar = withValidation({
|
||||
schema: schemaDestinationCalendar,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaDestinationCalendar, withValidDestinationCalendar };
|
||||
|
|
|
@ -8,7 +8,7 @@ const schemaEventType = z
|
|||
length: z.number().min(1).max(1440), // max is a full day.
|
||||
description: z.string().min(3).optional(),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
.strict();
|
||||
const withValidEventType = withValidation({
|
||||
schema: schemaEventType,
|
||||
type: "Zod",
|
||||
|
|
|
@ -1,65 +1,13 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
const schemaMembership = z
|
||||
.object({})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const withValidMembership = withValidation({
|
||||
schema: schemaMembership,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaMembership, withValidMembership };
|
||||
|
|
|
@ -1,65 +1,13 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const schemaPayment = z
|
||||
.object({})
|
||||
.strict();
|
||||
const withValidPayment = withValidation({
|
||||
schema: schemaPayment,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaPayment, withValidPayment };
|
||||
|
|
|
@ -1,65 +1,13 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const schemaSchedule = z
|
||||
.object({})
|
||||
.strict();
|
||||
const withValidSchedule = withValidation({
|
||||
schema: schemaSchedule,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaSchedule, withValidSchedule };
|
||||
|
|
|
@ -1,65 +1,13 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const schemaSelectedCalendar = z
|
||||
.object({})
|
||||
.strict();
|
||||
const withValidSelectedCalendar = withValidation({
|
||||
schema: schemaSelectedCalendar,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaSelectedCalendar, withValidSelectedCalendar };
|
||||
|
|
|
@ -9,7 +9,7 @@ const schemaTeam = z
|
|||
bio: z.string().min(3).optional(),
|
||||
logo: z.string().optional(),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
.strict();
|
||||
const withValidTeam = withValidation({
|
||||
schema: schemaTeam,
|
||||
type: "Zod",
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { schemaEventType } from "./eventType";
|
||||
// import { schemaCredential } from "./credential";
|
||||
// import { schemaMembership } from "./membership";
|
||||
// import { schemaBooking } from "./booking";
|
||||
// import { schemaSchedule } from "./schedule";
|
||||
// import { schemaSelectedCalendar } from "./selectedCalendar";
|
||||
// import { schemaAvailability } from "./availability";
|
||||
// import { schemaWebhook } from "./webhook";
|
||||
|
||||
import { z } from "zod";
|
||||
|
||||
import { schemaEventType } from "./eventType";
|
||||
import { schemaApiKey } from "./apiKey";
|
||||
import { schemaDestinationCalendar } from "./destination-calendar";
|
||||
import { schemaWebhook } from "./webhook";
|
||||
import { schemaAvailability } from "./availability";
|
||||
import { schemaSelectedCalendar } from "./selected-calendar";
|
||||
import { schemaBooking } from "./booking";
|
||||
import { schemaMembership } from "./membership";
|
||||
import { schemaSchedule } from "./schedule";
|
||||
import { schemaCredential } from "./credential";
|
||||
|
||||
const schemaUser = z
|
||||
.object({
|
||||
|
@ -27,12 +28,12 @@ const schemaUser = z
|
|||
theme: z.string().optional(),
|
||||
trialEndsAt: z.date().optional(),
|
||||
eventTypes: z.array((schemaEventType)).optional(),
|
||||
// credentials: z.array((schemaCredentials)).optional(),
|
||||
// teams: z.array((schemaMembership)).optional(),
|
||||
// bookings: z.array((schemaBooking)).optional(),
|
||||
// schedules: z.array((schemaSchedule)).optional(),
|
||||
credentials: z.array((schemaCredential)).optional(),
|
||||
teams: z.array((schemaMembership)).optional(),
|
||||
bookings: z.array((schemaBooking)).optional(),
|
||||
schedules: z.array((schemaSchedule)).optional(),
|
||||
defaultScheduleId: z.number().optional(),
|
||||
// selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
completedOnboarding: z.boolean().default(false),
|
||||
locale: z.string().optional(),
|
||||
timeFormat: z.number().optional().default(12),
|
||||
|
@ -40,19 +41,19 @@ const schemaUser = z
|
|||
twoFactorSecret: z.string().optional(),
|
||||
identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
identityProviderId: z.string().optional(),
|
||||
// availavility: z.array((schemaAvailavility)).optional(),
|
||||
availability: z.array((schemaAvailability)).optional(),
|
||||
invitedTo: z.number().optional(),
|
||||
plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// webhooks: z.array((schemaWebhook)).optional(),
|
||||
webhooks: z.array((schemaWebhook)).optional(),
|
||||
brandColor: z.string().default("#292929"),
|
||||
darkBrandColor: z.string().default("#fafafa"),
|
||||
// destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
destinationCalendar: z.array(schemaDestinationCalendar).optional(), // FIXME: instanceof doesnt work here
|
||||
away: z.boolean().default(false),
|
||||
metadata: z.object({}).optional(),
|
||||
verified: z.boolean().default(false),
|
||||
apiKeys: z.array((schemaApiKey)).optional(),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
.strict();
|
||||
const withValidUser = withValidation({
|
||||
schema: schemaUser,
|
||||
type: "Zod",
|
||||
|
|
|
@ -1,65 +1,14 @@
|
|||
import { withValidation } from "next-validations";
|
||||
import { z } from "zod";
|
||||
|
||||
const schemaBooking = z
|
||||
.object({
|
||||
uid: z.string().min(3),
|
||||
title: z.string().min(3),
|
||||
description: z.string().min(3).optional(),
|
||||
startTime: z.date().or(z.string()),
|
||||
endTime: z.date(),
|
||||
location: z.string().min(3).optional(),
|
||||
createdAt: z.date().or(z.string()),
|
||||
updatedAt: z.date(),
|
||||
confirmed: z.boolean().default(true),
|
||||
rejected: z.boolean().default(false),
|
||||
paid: z.boolean().default(false),
|
||||
const schemaWebhook = z
|
||||
.object({})
|
||||
.strict();
|
||||
|
||||
// bufferTime: z.number().default(0),
|
||||
// // attendees: z.array((schemaSchedule)).optional(),
|
||||
|
||||
// startTime: z.string().min(3),
|
||||
// endTime: z.string().min(3),
|
||||
// email: z.string().email(), // max is a full day.
|
||||
// emailVerified: z.date().optional(),
|
||||
// password: z.string().optional(),
|
||||
// bio: z.string().min(3).optional(),
|
||||
// avatar: z.string().optional(),
|
||||
// timeZone: z.string().default("Europe/London"),
|
||||
// weekStart: z.string().default("Sunday"),
|
||||
// bufferTime: z.number().default(0),
|
||||
// theme: z.string().optional(),
|
||||
// trialEndsAt: z.date().optional(),
|
||||
// eventTypes: z.array((schemaEventType)).optional(),
|
||||
// // credentials: z.array((schemaCredentials)).optional(),
|
||||
// // teams: z.array((schemaMembership)).optional(),
|
||||
// // bookings: z.array((schemaBooking)).optional(),
|
||||
// // schedules: z.array((schemaSchedule)).optional(),
|
||||
// defaultScheduleId: z.number().optional(),
|
||||
// // selectedCalendars: z.array((schemaSelectedCalendar)).optional(),
|
||||
// completedOnboarding: z.boolean().default(false),
|
||||
// locale: z.string().optional(),
|
||||
// timeFormat: z.number().optional().default(12),
|
||||
// twoFactorEnabled: z.boolean().default(false),
|
||||
// twoFactorSecret: z.string().optional(),
|
||||
// identityProvider: z.enum(["CAL", "SAML", "GOOGLE"]).optional().default("CAL"),
|
||||
// identityProviderId: z.string().optional(),
|
||||
// // availavility: z.array((schemaAvailavility)).optional(),
|
||||
// invitedTo: z.number().optional(),
|
||||
// plan: z.enum(['FREE', 'TRIAL', 'PRO']).default("TRIAL"),
|
||||
// // webhooks: z.array((schemaWebhook)).optional(),
|
||||
// brandColor: z.string().default("#292929"),
|
||||
// darkBrandColor: z.string().default("#fafafa"),
|
||||
// // destinationCalendar: z.instanceof(schemaEventType).optional(), // FIXME: instanceof doesnt work here
|
||||
// away: z.boolean().default(false),
|
||||
// metadata: z.object({}).optional(),
|
||||
// verified: z.boolean().default(false),
|
||||
})
|
||||
.strict(); // Adding strict so that we can disallow passing in extra fields
|
||||
const withValidBooking = withValidation({
|
||||
schema: schemaBooking,
|
||||
const withValidWebhook = withValidation({
|
||||
schema: schemaWebhook,
|
||||
type: "Zod",
|
||||
mode: "body",
|
||||
});
|
||||
|
||||
export { schemaBooking, withValidBooking };
|
||||
export { schemaWebhook, withValidWebhook };
|
||||
|
|
Loading…
Reference in New Issue