Add design approval workflow infrastructure: PATCH endpoint, email notifications, and message types

- Add PATCH method to /api/designs/[id]/route.ts for status updates
- Create sendDesignReadyForReview email template for customer notifications
- Enhance /api/designs/[id]/messages to support messageType field (MESSAGE | CHANGE_REQUEST)
- Add database migration for messageType field with MESSAGE default

This completes the backend infrastructure for the multi-step design approval workflow:
1. Admin edits and sends design to customer for review
2. Customer approves design or requests changes
3. Admin receives notifications for change requests

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Andymick
2026-07-18 17:11:10 +01:00
co-authored by Claude Haiku 4.5
parent 4d124b1550
commit ac27cc554b
10 changed files with 431 additions and 42 deletions
+2 -1
View File
@@ -196,7 +196,7 @@ model DesignApproval {
designImageDimensions String? // JSON array of {imageId, widthCm, heightCm} for each uploaded image
color String
size String?
status String @default("PENDING") // PENDING | APPROVED | REJECTED
status String @default("PENDING") // PENDING | IN_REVIEW | APPROVED | REJECTED
messages DesignApprovalMessage[]
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@ -209,6 +209,7 @@ model DesignApprovalMessage {
design DesignApproval @relation(fields: [designId], references: [id], onDelete: Cascade)
sender String // "ADMIN" | "CUSTOMER"
body String
messageType String @default("MESSAGE") // MESSAGE | CHANGE_REQUEST
createdAt DateTime @default(now())
}