diff --git a/prisma/migrations/20241010050224_add_flow_to_service/migration.sql b/prisma/migrations/20241010050224_add_flow_to_service/migration.sql new file mode 100644 index 0000000..3da0fbd --- /dev/null +++ b/prisma/migrations/20241010050224_add_flow_to_service/migration.sql @@ -0,0 +1,5 @@ +-- AlterTable +ALTER TABLE "Service" ADD COLUMN "workflowTemplateId" TEXT; + +-- AddForeignKey +ALTER TABLE "Service" ADD CONSTRAINT "Service_workflowTemplateId_fkey" FOREIGN KEY ("workflowTemplateId") REFERENCES "WorkflowTemplate"("id") ON DELETE SET NULL ON UPDATE CASCADE; diff --git a/prisma/schema.prisma b/prisma/schema.prisma index 5c5d2af..4763434 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -901,6 +901,8 @@ model WorkflowTemplate { updatedAt DateTime @updatedAt updatedBy User? @relation(name: "FlowUpdatedByUser", fields: [updatedByUserId], references: [id], onDelete: SetNull) updatedByUserId String? + + service Service[] } model WorkflowTemplateStep { @@ -1006,6 +1008,9 @@ model Service { status Status @default(CREATED) statusOrder Int @default(0) + workflowTemplateId String? + workflowTemplate WorkflowTemplate? @relation(fields: [workflowTemplateId], references: [id]) + shared Boolean @default(false) selectedImage String? diff --git a/src/controllers/04-service-controller.ts b/src/controllers/04-service-controller.ts index 113f46e..5e5c335 100644 --- a/src/controllers/04-service-controller.ts +++ b/src/controllers/04-service-controller.ts @@ -54,6 +54,7 @@ type ServiceCreate = { [key: string]: any; }; status?: Status; + workflowId?: string; work?: { name: string; productId: string[]; @@ -71,6 +72,7 @@ type ServiceUpdate = { [key: string]: any; }; status?: "ACTIVE" | "INACTIVE"; + workflowId?: string; work?: { name: string; productId: string[];