Save reminderPhone to DB

docs/contribute-to-app-store
Joe Au-Yeung 2022-03-08 17:57:39 -05:00
parent 17e025f3c2
commit 46d893768d
5 changed files with 18 additions and 1 deletions

View File

@ -215,6 +215,7 @@ const BookingPage = (props: BookingPageProps) => {
};
const bookEvent = (booking: BookingFormValues) => {
console.log("🚀 ~ file: BookingPage.tsx ~ line 218 ~ bookEvent ~ booking", booking);
telemetry.withJitsu((jitsu) =>
jitsu.track(telemetryEventTypes.bookingConfirmed, collectPageParameters())
);
@ -481,7 +482,7 @@ const BookingPage = (props: BookingPageProps) => {
<PhoneInput
// @ts-expect-error
control={bookingForm.control}
name="phone"
name="reminderPhone"
placeholder={t("enter_phone_number")}
id="reminderPhone"
/>

View File

@ -55,6 +55,7 @@ export interface CalendarEvent {
destinationCalendar?: DestinationCalendar | null;
cancellationReason?: string | null;
rejectionReason?: string | null;
reminderPhone?: string;
}
export interface IntegrationCalendar extends Ensure<Partial<SelectedCalendar>, "externalId"> {

View File

@ -50,6 +50,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
}
const reqBody = req.body as BookingConfirmBody;
console.log("🚀 ~ file: confirm.ts ~ line 53 ~ handler ~ reqBody", reqBody);
const bookingId = reqBody.id;
if (!bookingId) {

View File

@ -232,6 +232,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
currency: true,
metadata: true,
destinationCalendar: true,
attendeeReminders: true,
},
});
@ -342,6 +343,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
location: reqBody.location, // Will be processed by the EventManager later.
/** For team events, we will need to handle each member destinationCalendar eventually */
destinationCalendar: eventType.destinationCalendar || users[0].destinationCalendar,
reminderPhone: reqBody.reminderPhone,
};
if (eventType.schedulingType === SchedulingType.COLLECTIVE) {
@ -406,6 +408,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
connect: { id: evt.destinationCalendar.id },
}
: undefined,
reminderPhone: evt.reminderPhone,
},
});
}

View File

@ -254,6 +254,7 @@ model Booking {
cancellationReason String?
rejectionReason String?
reminderPhone String?
attendeeReminder AttendeeReminder?
}
model Schedule {
@ -325,6 +326,16 @@ model EventTypeAttendeeReminder {
time Int
}
model AttendeeReminder {
id Int @id @default(autoincrement())
bookingId Int @unique
booking Booking @relation(fields: [bookingId], references: [id])
method String
referenceId Int
scheduledFor DateTime
sent Boolean
}
model ResetPasswordRequest {
id String @id @default(cuid())
createdAt DateTime @default(now())