-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement signing field groups and assigned groups #273
Merged
Merged
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d70cc43
Implement signing field groups and assigned groups
elvincheng3 83c55ad
Refactor seeding
elvincheng3 ef1d3b6
Fix lint
elvincheng3 a7ad0a9
Merge branch 'main' into implement-signing-groups
elvincheng3 d63dcd6
Fix frontend
elvincheng3 e8741f1
eslint
elvincheng3 455a803
Add field type
elvincheng3 7c3b3ad
Merge branch 'main' into implement-signing-groups
elvincheng3 d95071f
fix tsc
elvincheng3 ae8bc84
Fix test
elvincheng3 6605233
Merge branch 'main' into implement-signing-groups
elvincheng3 221f79a
Remove metadata?
elvincheng3 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
133 changes: 133 additions & 0 deletions
133
apps/server/prisma/migrations/20250207030005_implement_signing_group/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/* | ||
Warnings: | ||
|
||
- You are about to drop the `Signature` table. If the table is not empty, all the data it contains will be lost. | ||
- You are about to drop the `SignatureField` table. If the table is not empty, all the data it contains will be lost. | ||
|
||
*/ | ||
-- CreateEnum | ||
CREATE TYPE "SignatureBoxFieldType" AS ENUM ('SIGNATURE', 'CHECKBOX'); | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Signature" DROP CONSTRAINT "Signature_employeeId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Signature" DROP CONSTRAINT "Signature_formInstanceId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Signature" DROP CONSTRAINT "Signature_signerDepartmentId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Signature" DROP CONSTRAINT "Signature_signerEmployeeId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Signature" DROP CONSTRAINT "Signature_signerPositionId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "Signature" DROP CONSTRAINT "Signature_signingEmployeeId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "SignatureField" DROP CONSTRAINT "SignatureField_formTemplateId_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "_signerEmployeeList" DROP CONSTRAINT "_signerEmployeeList_A_fkey"; | ||
|
||
-- DropForeignKey | ||
ALTER TABLE "_signerEmployeeList" DROP CONSTRAINT "_signerEmployeeList_B_fkey"; | ||
|
||
-- DropTable | ||
DROP TABLE "Signature"; | ||
|
||
-- DropTable | ||
DROP TABLE "SignatureField"; | ||
|
||
-- CreateTable | ||
CREATE TABLE "FieldGroup" ( | ||
"id" UUID NOT NULL, | ||
"name" VARCHAR(255) NOT NULL, | ||
"order" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"formTemplateId" UUID NOT NULL, | ||
|
||
CONSTRAINT "FieldGroup_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "TemplateBox" ( | ||
"id" UUID NOT NULL, | ||
"type" "SignatureBoxFieldType" NOT NULL, | ||
"x_coordinate" INTEGER NOT NULL, | ||
"y_coordinate" INTEGER NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"fieldGroupId" UUID NOT NULL, | ||
|
||
CONSTRAINT "TemplateBox_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "AssignedGroup" ( | ||
"id" UUID NOT NULL, | ||
"order" INTEGER NOT NULL, | ||
"signed" BOOLEAN NOT NULL DEFAULT false, | ||
"signedDocLink" VARCHAR(255), | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"signerPositionId" UUID, | ||
"signerDepartmentId" UUID, | ||
"signerEmployeeId" UUID, | ||
"signingEmployeeId" UUID, | ||
"signerType" "SignerType" NOT NULL, | ||
"formInstanceId" UUID NOT NULL, | ||
"fieldGroupId" UUID NOT NULL, | ||
|
||
CONSTRAINT "AssignedGroup_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- CreateTable | ||
CREATE TABLE "InstanceBox" ( | ||
"id" UUID NOT NULL, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"updatedAt" TIMESTAMP(3) NOT NULL, | ||
"assignedGroupId" UUID NOT NULL, | ||
"templateBoxId" UUID NOT NULL, | ||
|
||
CONSTRAINT "InstanceBox_pkey" PRIMARY KEY ("id") | ||
); | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "FieldGroup" ADD CONSTRAINT "FieldGroup_formTemplateId_fkey" FOREIGN KEY ("formTemplateId") REFERENCES "FormTemplate"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "TemplateBox" ADD CONSTRAINT "TemplateBox_fieldGroupId_fkey" FOREIGN KEY ("fieldGroupId") REFERENCES "FieldGroup"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AssignedGroup" ADD CONSTRAINT "AssignedGroup_signerPositionId_fkey" FOREIGN KEY ("signerPositionId") REFERENCES "Position"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AssignedGroup" ADD CONSTRAINT "AssignedGroup_signerDepartmentId_fkey" FOREIGN KEY ("signerDepartmentId") REFERENCES "Department"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AssignedGroup" ADD CONSTRAINT "AssignedGroup_signerEmployeeId_fkey" FOREIGN KEY ("signerEmployeeId") REFERENCES "Employee"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AssignedGroup" ADD CONSTRAINT "AssignedGroup_signingEmployeeId_fkey" FOREIGN KEY ("signingEmployeeId") REFERENCES "Employee"("id") ON DELETE SET NULL ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AssignedGroup" ADD CONSTRAINT "AssignedGroup_formInstanceId_fkey" FOREIGN KEY ("formInstanceId") REFERENCES "FormInstance"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "AssignedGroup" ADD CONSTRAINT "AssignedGroup_fieldGroupId_fkey" FOREIGN KEY ("fieldGroupId") REFERENCES "FieldGroup"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "InstanceBox" ADD CONSTRAINT "InstanceBox_assignedGroupId_fkey" FOREIGN KEY ("assignedGroupId") REFERENCES "AssignedGroup"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "InstanceBox" ADD CONSTRAINT "InstanceBox_templateBoxId_fkey" FOREIGN KEY ("templateBoxId") REFERENCES "TemplateBox"("id") ON DELETE RESTRICT ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_signerEmployeeList" ADD CONSTRAINT "_signerEmployeeList_A_fkey" FOREIGN KEY ("A") REFERENCES "AssignedGroup"("id") ON DELETE CASCADE ON UPDATE CASCADE; | ||
|
||
-- AddForeignKey | ||
ALTER TABLE "_signerEmployeeList" ADD CONSTRAINT "_signerEmployeeList_B_fkey" FOREIGN KEY ("B") REFERENCES "Employee"("id") ON DELETE CASCADE ON UPDATE CASCADE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text box?