feat(GRO-1208): add staff conversations API route and staffReadAt migration
- Add `staffReadAt` column to conversations table schema - Add migration 0032_staff_read_at.sql for the new column - Create /api/conversations router with GET / (list), GET /:id/messages (paginated), POST /:id/messages (send) - Mark conversations as read (staffReadAt = NOW()) when staff fetches messages - Return 409 when client has opted out of SMS - 404 on cross-tenant access - Add conversations.test.ts covering all 5 acceptance criteria Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -0,0 +1 @@
|
||||
ALTER TABLE "conversations" ADD COLUMN "staff_read_at" timestamp;
|
||||
@@ -218,6 +218,20 @@
|
||||
"when": 1775828067192,
|
||||
"tag": "0030_messaging",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 31,
|
||||
"version": "7",
|
||||
"when": 1778732072097,
|
||||
"tag": "0031_steady_veda",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 32,
|
||||
"version": "7",
|
||||
"when": 1778818472097,
|
||||
"tag": "0032_staff_read_at",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -444,6 +444,7 @@ export const conversations = pgTable(
|
||||
status: text("status").notNull().default("active"),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
updatedAt: timestamp("updated_at").notNull().defaultNow(),
|
||||
staffReadAt: timestamp("staff_read_at"),
|
||||
},
|
||||
(t) => [
|
||||
index("idx_conversations_business_id_last_message_at").on(
|
||||
|
||||
Reference in New Issue
Block a user