Backoffice stage 2: chats (support + concierge, files)
- ChatThread per client/provider and channel; messages get files, internal notes, source (bot/mini app) and delivery errors; reply templates. Migration moves old concierge messages into threads. - Routing: subscribers write to the concierge, others to support; /support and /concierge in the client bot; staff can take, transfer, close and move threads. - Telegram: photos/documents from clients and providers, replies with the channel header, files sent from storage, notifications only to the assignee or the channel's staff, "Reply" into a specific thread. - New admin: /chats with list, conversation, notes, files, templates, client panel; "Message" button on the client card; dashboard counts threads awaiting reply. - Client mini app: in-app chat screen sharing the same conversation. - Old admin keeps working on the same data (notes hidden there). - Tests for routing, notes, assign/close/move, lists, recipients; separate test DB via TEST_DB_NAME; dev:chats-demo script. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
d452824c62
commit
23ffb2bf1d
46 files changed
+4176
-144
No files matched your search
@@ -28,6 +28,9 @@ await db.order.deleteMany({ where: { clientId: { in: oldClientIds } } });
|
||||
await db.subscription.deleteMany({ where: { clientId: { in: oldClientIds } } });
|
||||
await db.cardUsage.deleteMany({ where: { clientId: { in: oldClientIds } } });
|
||||
await db.auditLog.deleteMany({ where: { entityId: { in: oldClientIds } } });
|
||||
// демо-чаты (dev:chats-demo) ссылаются на клиентов
|
||||
await db.chatThread.deleteMany({ where: { clientId: { in: oldClientIds } } });
|
||||
await db.conciergeMessage.deleteMany({ where: { clientId: { in: oldClientIds } } });
|
||||
await db.client.deleteMany({ where: { id: { in: oldClientIds } } });
|
||||
await db.user.deleteMany({ where: { id: { in: old.map((u) => u.id) } } });
|
||||
await db.lead.deleteMany({ where: { contact: { startsWith: '+374 99 00' } } });
|
||||
@@ -40,7 +43,7 @@ const [services, agencies, providers, partners, owner] = await Promise.all([
|
||||
db.adminUser.findFirst({ where: { roles: { has: 'SUPERADMIN' } } }),
|
||||
]);
|
||||
|
||||
const PEOPLE: [string, string | null, string, 'ru' | 'en' | 'hy' | 'zh' | 'es'][] = [
|
||||
const PEOPLE: [string, string | null, string | null, 'ru' | 'en' | 'hy' | 'zh' | 'es'][] = [
|
||||
['Мария', 'Иванова', 'masha_iv', 'ru'],
|
||||
['Дмитрий', 'Козлов', 'dkozlov', 'ru'],
|
||||
['Sarah', 'Miller', 'sarah_m', 'en'],
|
||||
|
||||
Reference in new issue
Block a user