## New columns in hcAppointments table ``` json { OvernightDate: "07-07-2023", // stores End Date, a sign of Overnight appointment StartDateBeforeVerification: "07-07-2023", // original start date before verification EndDateBeforeVerification: "07-07-2023", // original overnight date before verification OriginalOvernightAppointmentId: 0 // link to original OA. used only in split appointments } ``` ## Short answers on questions ### How can we tell if an appointment is an overnight appointment? All Overnight appointments has `OvernightDate` value, while usual appointments don't. We can use this fact to determine whether an appointment is an overnight appointment. ### How can we tell if an appointment has been split? Split appointments have `OriginalOvernightAppointmentId`. ### Are the start/end times going to be saved the same way as a normal appointment? "ActualStartDate"/"ActualEndDate" No, we implemented it in opposite way. Now `StartDate` and `OvernightDate` is only source of truth for actual dates so we don't need to evaluate it like this: `startDate = startDate ?? actualStartDate`. We store original dates in `StartDateBeforeVerification` and `EndDateBeforeVerification` columns since they used only(?) in Staff Verification pop-up as text. ### Are there any changes to the way we save appointments? There are several changes in verification process. - When Staff verifies an Overnight appointment and sets **Overnight Date** (End Date) equal **Start Date**, than we clear overnight date and save the appointment as usual one. Example of payload ```json { // ... StartDate: "07/07/2023", OvernightDate: null, StartDateBeforeVerification: "07/07/2023", EndDateBeforeVerification: "07/08/2023" // ... } ``` - When Staff verifies a usual appointment and sets the **Overnight Date** (End Date) one day later than the **Start Date**, than we provide `OvernightDate` value.`EndDateBeforeVerification` equals original `StartDate` ```json { // ... StartDate: "07/07/2023", OvernightDate: "07/08/2023", StartDateBeforeVerification: "07/07/2023", EndDateBeforeVerification: "07/07/2023" // ... } ``` ## **P.S.** In some cases `OvernightDate` can equal `StartDate`. For example, a Staff with Hawaii TZ schedules an overnight appointment for `07/14 11:00 pm - 07/15 01:00 am`. Since we store all dates in EST time zone, Web App will convert this appointment to `**07/15** 05:00 am - **07/15** 07:00 am. ```json { // ... StartDate: "07/15/2023", OvernightDate: "07/15/2023", StartTime: 300, // 5 am EndTime: 420 // 7 am // ... }