feat: Record assignment reasons for routing form and reassignment (#17767)
* Add assignment reason table * Increment id * Update migration * Record assignment when manual reassignment is used * Add comment to `getAttributesQueryValue` * Add `getUsersAttributes` * Record routing form routing reason * Type fixes * Remove unique property from bookingId * Handle nested values
This commit is contained in:
1 parent
5d51c79739
commit
ff79e5c70e
7 files changed
+206
-2
No files matched your search
@@ -0,0 +1,19 @@
|
||||
-- CreateEnum
|
||||
CREATE TYPE "AssignmentReasonEnum" AS ENUM ('ROUTING_FORM_ROUTING', 'ROUTING_FORM_ROUTING_FALLBACK', 'REASSIGNED', 'REROUTED', 'SALESFORCE_ASSIGNMENT');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "AssignmentReason" (
|
||||
"id" SERIAL NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"bookingId" INTEGER NOT NULL,
|
||||
"reasonEnum" "AssignmentReasonEnum" NOT NULL,
|
||||
"reasonString" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "AssignmentReason_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "AssignmentReason_id_key" ON "AssignmentReason"("id");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "AssignmentReason" ADD CONSTRAINT "AssignmentReason_bookingId_fkey" FOREIGN KEY ("bookingId") REFERENCES "Booking"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
@@ -648,6 +648,7 @@ model Booking {
|
||||
rescheduledBy String?
|
||||
// Ah, made a typo here. Should have been routedFromRoutingFormRe"s"ponse. Live with it :(
|
||||
routedFromRoutingFormReponse App_RoutingForms_FormResponse?
|
||||
assignmentReason AssignmentReason[]
|
||||
|
||||
@@index([eventTypeId])
|
||||
@@index([userId])
|
||||
@@ -1608,6 +1609,23 @@ model AttributeToUser {
|
||||
@@unique([memberId, attributeOptionId])
|
||||
}
|
||||
|
||||
enum AssignmentReasonEnum {
|
||||
ROUTING_FORM_ROUTING
|
||||
ROUTING_FORM_ROUTING_FALLBACK
|
||||
REASSIGNED
|
||||
REROUTED
|
||||
SALESFORCE_ASSIGNMENT
|
||||
}
|
||||
|
||||
model AssignmentReason {
|
||||
id Int @id @unique @default(autoincrement())
|
||||
createdAt DateTime @default(now())
|
||||
bookingId Int
|
||||
booking Booking @relation(fields: [bookingId], references: [id], onDelete: Cascade)
|
||||
reasonEnum AssignmentReasonEnum
|
||||
reasonString String
|
||||
}
|
||||
|
||||
enum EventTypeAutoTranslatedField {
|
||||
DESCRIPTION // Currently the only field we translate
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user