feat: Headless router - queue recording booking response (#21805)
* Add queued booking response table * Create `RoutingFormResponseRepository` * Pass `queueFormResponse` param * Queue up form response if param is passed * Forward queued form response parma to booker * Pass `queuedFormResponse` from booker to `handleNewBooking` * Write queued routing form response * Type fixes * Clean up * Allow dry run to work which wont have any QueuedFormResponse or FormResponse * Support passing the time when the modal was actually shown to the user and consider that time as the time of form submission * fix ts error * Queue -> Response through separate endpoint that would be triggered by embed * Make queueResponseId a non-guessable uid * Change queueFormResponse query param * fix ts error * Support useQueuedResponse to record new response data * revert handleNewBooking * Remove dead code formResponse * Refactor use repository * Unify migration files * refactor: moved api endpoint to app dir Signed-off-by: Omar López <[email protected]> * Update formResponse.ts * Refactor use-queued-response for test * Add tests * Fix ts error and unit test. recordFormResponse cant return nullish response * fix schema * feat: Support full reuse of preloaded iframe (#21803) * feat: support updating cal video settings in API v2 (#21784) * feat: support updating cal video settings in API v2 * chore: update descriptio * feat: support create event type * test: add test for updating event type * test: add test for create event type * chore: undo openapi * chore: bump libraries * Revert "chore: bump libraries" This reverts commit bdf36d09b021fc531497a7b7ea66ab9c52b7d136. * chore: bump libraries --------- Co-authored-by: Lauris Skraucis <[email protected]> Co-authored-by: supalarry <[email protected]> * fix tests and ts * Fix tests * wip-useQueuedResponseEndpoint * Add one more test * Change queueFormResponse query param * wip * Support useQueuedResponse to record new response data * Use the update useQueuedResponse endpoint * self-review addressed * Use queuedResponse if available in slots/utils * Add documentation * Remove use-queued-response from critical-path --------- Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Lauris Skraucis <[email protected]> Co-authored-by: supalarry <[email protected]> * Update schema.prisma * refactor: renamed to avoid react hooks confusion Signed-off-by: Omar López <[email protected]> --------- Signed-off-by: Omar López <[email protected]> Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: Omar López <[email protected]> Co-authored-by: Udit Takkar <[email protected]> Co-authored-by: Lauris Skraucis <[email protected]> Co-authored-by: supalarry <[email protected]> Co-authored-by: Peer Richelsen <[email protected]>
This commit is contained in:
28 files changed
+1408
-424
No files matched your search
@@ -0,0 +1,21 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "App_RoutingForms_QueuedFormResponse" (
|
||||
"id" TEXT NOT NULL,
|
||||
"formId" TEXT NOT NULL,
|
||||
"response" JSONB NOT NULL,
|
||||
"chosenRouteId" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3),
|
||||
"actualResponseId" INTEGER,
|
||||
|
||||
CONSTRAINT "App_RoutingForms_QueuedFormResponse_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "App_RoutingForms_QueuedFormResponse_actualResponseId_key" ON "App_RoutingForms_QueuedFormResponse"("actualResponseId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "App_RoutingForms_QueuedFormResponse" ADD CONSTRAINT "App_RoutingForms_QueuedFormResponse_formId_fkey" FOREIGN KEY ("formId") REFERENCES "App_RoutingForms_Form"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "App_RoutingForms_QueuedFormResponse" ADD CONSTRAINT "App_RoutingForms_QueuedFormResponse_actualResponseId_fkey" FOREIGN KEY ("actualResponseId") REFERENCES "App_RoutingForms_FormResponse"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -1138,6 +1138,7 @@ model App_RoutingForms_Form {
|
||||
team Team? @relation(fields: [teamId], references: [id], onDelete: Cascade)
|
||||
teamId Int?
|
||||
responses App_RoutingForms_FormResponse[]
|
||||
queuedResponses App_RoutingForms_QueuedFormResponse[]
|
||||
disabled Boolean @default(false)
|
||||
/// @zod.custom(imports.RoutingFormSettings)
|
||||
settings Json?
|
||||
@@ -1156,12 +1157,13 @@ model App_RoutingForms_FormResponse {
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime? @updatedAt
|
||||
|
||||
routedToBookingUid String? @unique
|
||||
routedToBookingUid String? @unique
|
||||
// We should not cascade delete the booking, because we want to keep the form response even if the routedToBooking is deleted
|
||||
routedToBooking Booking? @relation(fields: [routedToBookingUid], references: [uid])
|
||||
routedToBooking Booking? @relation(fields: [routedToBookingUid], references: [uid])
|
||||
chosenRouteId String?
|
||||
routingFormResponseFields RoutingFormResponseField[]
|
||||
routingFormResponses RoutingFormResponseDenormalized[]
|
||||
queuedFormResponse App_RoutingForms_QueuedFormResponse?
|
||||
|
||||
@@unique([formFillerId, formId])
|
||||
@@index([formFillerId])
|
||||
@@ -1169,6 +1171,18 @@ model App_RoutingForms_FormResponse {
|
||||
@@index([routedToBookingUid])
|
||||
}
|
||||
|
||||
model App_RoutingForms_QueuedFormResponse {
|
||||
id String @id @default(cuid())
|
||||
form App_RoutingForms_Form @relation(fields: [formId], references: [id], onDelete: Cascade)
|
||||
formId String
|
||||
response Json
|
||||
chosenRouteId String?
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime? @updatedAt
|
||||
actualResponseId Int? @unique
|
||||
actualResponse App_RoutingForms_FormResponse? @relation(fields: [actualResponseId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model RoutingFormResponseField {
|
||||
id Int @id @default(autoincrement())
|
||||
responseId Int
|
||||
|
||||
Reference in new issue
Block a user