feat: add workflow to service

This commit is contained in:
Methapon Metanipat 2024-10-10 12:03:40 +07:00
parent a583e6a3ce
commit a06be541a8
3 changed files with 12 additions and 0 deletions

View file

@ -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;

View file

@ -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?

View file

@ -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[];