Chats: show which order a provider writes about, or that there is no order

- Provider messages store the order that was current when they wrote: a started
  order first, otherwise the nearest assigned one within -4h..+12h; none — "no order".
- Admin chat: order tag above each provider message, "now / next" order strip in
  the conversation header, order number (or "no order") in the thread list.
- Telegram notification to the team gets an order line or "no current order".
- Test for the order-picking rule; demo shows both cases.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
zabudko-ruandClaude Opus 5.5 committed 2026-10-21 02:02:31 +04:00
1 parent 23ffb2bf1d
commit 2772837e29
14 files changed
+321 -13

No files matched your search

+4
View File
@@ -465,6 +465,7 @@ model Order {
offers OrderOffer[]
files OrderFile[]
messages Message[]
chatMessages ConciergeMessage[]
estimates Estimate[]
rating Rating?
lessons LessonPackage?
@@ -1152,6 +1153,9 @@ model ConciergeMessage {
size Int?
/// не удалось доставить в Telegram (клиент заблокировал бота и т.п.)
deliveryError String?
/// исполнитель писал по этому заказу (текущий заказ в момент сообщения); null — заказа тогда не было
orderId String?
order Order? @relation(fields: [orderId], references: [id], onDelete: SetNull)
/// оператор прочитал сообщение клиента
readAt DateTime?
createdAt DateTime @default(now())