feat: track who updated routing form (#19079)

* chore: updatedBy App_RoutingForms_Form schema field

* feat: track who updated routing form
This commit is contained in:
Lauris Skraucis
2025-02-06 11:52:53 -03:00
committed by GitHub
parent 3a522320e7
commit 0b46415856
4 changed files with 12 additions and 0 deletions
@@ -63,6 +63,7 @@ export const formMutationHandler = async ({ ctx, input }: FormMutationHandlerOpt
settings: true,
teamId: true,
position: true,
updatedById: true,
},
});
@@ -145,6 +146,7 @@ export const formMutationHandler = async ({ ctx, input }: FormMutationHandlerOpt
description,
settings: settings === null ? Prisma.JsonNull : settings,
routes: routes === null ? Prisma.JsonNull : routes,
updatedById: user.id,
},
});
@@ -269,6 +271,7 @@ export const formMutationHandler = async ({ ctx, input }: FormMutationHandlerOpt
},
data: {
fields: updatedConnectedFormFields,
updatedById: user.id,
},
});
}
@@ -18,6 +18,7 @@ class VirtualQueuesInsights {
teamId: number | null;
disabled: boolean;
settings: JsonField | null;
updatedById: number | null;
};
const formsRedirectingToWeightedRR: RoutingFormType[] = await prisma.$queryRaw<RoutingFormType[]>`
@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "App_RoutingForms_Form" ADD COLUMN "updatedById" INTEGER;
-- AddForeignKey
ALTER TABLE "App_RoutingForms_Form" ADD CONSTRAINT "App_RoutingForms_Form_updatedById_fkey" FOREIGN KEY ("updatedById") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
+3
View File
@@ -339,6 +339,7 @@ model User {
ownedEventTypes EventType[] @relation("owner")
workflows Workflow[]
routingForms App_RoutingForms_Form[] @relation("routing-form")
updatedRoutingForms App_RoutingForms_Form[] @relation("updated-routing-form")
verifiedNumbers VerifiedNumber[]
verifiedEmails VerifiedEmail[]
hosts Host[]
@@ -1003,6 +1004,8 @@ model App_RoutingForms_Form {
name String
fields Json?
user User @relation("routing-form", fields: [userId], references: [id], onDelete: Cascade)
updatedBy User? @relation("updated-routing-form", fields: [updatedById], references: [id], onDelete: SetNull)
updatedById Int?
// This is the user who created the form and also the user who has read-write access to the form
// If teamId is set, the members of the team would also have access to form readOnly or read-write depending on their permission level as team member.
userId Int