chore: change timezone format and update webhook (#14433)

* chore: change timezone format

* chore: set guest email and guest company to null

* feat: also check states to get id

* chore: improve code

* chore: fix type erro

* chore: update zod schema
This commit is contained in:
Udit Takkar authored and GitHub committed 2024-04-08 15:26:31 +05:30
1 parent 67262910cd
commit 74dc46f8b2
4 files changed
+57 -12

No files matched your search

@@ -16,8 +16,8 @@ export const EventTypeUpdateInput = _EventTypeModel
yourPhoneNumber: z.string().default(""),
numberToCall: z.string().default(""),
guestName: z.string().default(""),
guestEmail: z.string().default(""),
guestCompany: z.string().default(""),
guestEmail: z.string().nullable().default(null),
guestCompany: z.string().nullable().default(null),
})
.optional(),
calAiPhoneScript: z.string().optional(),
@@ -372,9 +372,15 @@ export const updateHandler = async ({ ctx, input }: UpdateOptions) => {
where: {
eventTypeId: id,
},
update: aiPhoneCallConfig,
update: {
...aiPhoneCallConfig,
guestEmail: !!aiPhoneCallConfig?.guestEmail ? aiPhoneCallConfig.guestEmail : null,
guestCompany: !!aiPhoneCallConfig?.guestCompany ? aiPhoneCallConfig.guestCompany : null,
},
create: {
...aiPhoneCallConfig,
guestEmail: !!aiPhoneCallConfig?.guestEmail ? aiPhoneCallConfig.guestEmail : null,
guestCompany: !!aiPhoneCallConfig?.guestCompany ? aiPhoneCallConfig.guestCompany : null,
eventTypeId: id,
},
});