This commit is contained in:
seb
2026-10-14 00:21:31 +02:00
parent 74b24686bc
commit f9ed4fe75d
18 changed files with 1508 additions and 279 deletions

View File

@@ -53,6 +53,8 @@ export function register(app, basePath = '') {
* | `modelconversation` | `{}` | `POST /modelconversation`, `DELETE /modelconversation/{id}` |
* | `modelconversation-<id>` | `{}` | Conversation-specific updates on the same model conversation thread; the concrete ID is used in the event name |
* | `brand` | `{ sender, brandId }` | `POST /brand`, `PATCH /brand/{id}`, `DELETE /brand/{id}`, `POST /brand/{id}/image`, `DELETE /brand/{id}/image` |
* | `draft` | `{ sender, action, name, content }` | Draft update on `drafts/quote`, `drafts/order`, `drafts/delivery` (`sender` echoes the caller's `x-client-id`) |
* | `draft:request` | `{ requestId, action, name, target, sender }` | Server request to frontend to read a draft or list drafts |
*
* The `brand` payload is `{ sender, brandId }`: `sender` echoes the
* caller's `x-client-id` header (empty string if absent) so the sender
@@ -95,6 +97,10 @@ export function register(app, basePath = '') {
* payload: "{}"
* - name: brand
* payload: "{ sender, brandId }"
* - name: draft
* payload: "{ sender, action, name, content }"
* - name: draft:request
* payload: "{ requestId, action, name, target, sender }"
* responses:
* 200:
* description: |
@@ -157,5 +163,6 @@ export function handleSse(req, res) {
// Send an initial ping to establish frame
res.write(': ping\n\n');
subscribe(res, { companyId, userId: req.user?.id }, req);
const clientId = req.query?.cid || req.headers?.['x-client-id'] || null;
subscribe(res, { companyId, userId: req.user?.id, clientId }, req);
}