From 158748c5e6a1066aaa9624660b41a8ed407a8d72 Mon Sep 17 00:00:00 2001 From: seb Date: Wed, 28 Oct 2026 23:09:50 +0100 Subject: [PATCH] u --- docs/api/README.md | 1 + docs/api/routes-all.md | 1 + docs/api/routes/events.md | 1 + docs/api/routes/supplier/create.md | 4 ++++ docs/api/routes/supplier/delete.md | 4 ++++ docs/api/routes/supplier/update.md | 4 ++++ src/api/routes/events.js | 3 +++ src/api/routes/supplier.js | 7 +++++++ 8 files changed, 25 insertions(+) diff --git a/docs/api/README.md b/docs/api/README.md index 33be69d..f2f0ce1 100644 --- a/docs/api/README.md +++ b/docs/api/README.md @@ -345,6 +345,7 @@ Clients subscribe via [`GET /events`](routes/events.md) (`text/event-stream`). A | `shipping` | `POST /stock/ship` | | `stock` | `DELETE /shipment/{id}`, `POST /stock/accept`, `POST /stock/adjust`, `POST /stock/ship` | | `subagentschedule` | `POST /subagentschedule`, `DELETE /subagentschedule/{id}`, `PUT /subagentschedule/{id}` | +| `supplier` | `POST /supplier`, `DELETE /supplier/{id}`, `PATCH /supplier/{id}` | | `user` | `PUT /auth/selected-company`, `POST /company`, `DELETE /company/{id}` | | `vfs` | `POST /vfs/applets/restore`, `POST /vfs/mkdir`, `POST /vfs/rename`, `POST /vfs/skills/restore`, `POST /vfs/upload`, `DELETE /vfs/{*path}`, `POST /vfs/{*path}`, `PUT /vfs/{*path}` | | `warehouse` | `POST /warehouse`, `PUT /warehouse/order`, `DELETE /warehouse/{id}`, `PUT /warehouse/{id}` | diff --git a/docs/api/routes-all.md b/docs/api/routes-all.md index 91e5553..1ed6abd 100644 --- a/docs/api/routes-all.md +++ b/docs/api/routes-all.md @@ -490,6 +490,7 @@ _none_ - `labeltemplate`: `{}` - `printer`: `{}` - `warehouse`: `{}` + - `supplier`: `{}` - `vfs`: `{}` - `modelconversation`: `{}` - `modelconversation-`: `{}` diff --git a/docs/api/routes/events.md b/docs/api/routes/events.md index 53e1b49..8800602 100644 --- a/docs/api/routes/events.md +++ b/docs/api/routes/events.md @@ -47,6 +47,7 @@ emits `{ sender, brandId }`. | `labeltemplate` | `{}` | `POST /labeltemplate`, `PUT /labeltemplate/{id}`, `PATCH /labeltemplate/{id}`, `DELETE /labeltemplate/{id}` | | `printer` | `{}` | `POST /printer`, `PUT /printer/{id}`, `PATCH /printer/{id}`, `DELETE /printer/{id}` | | `warehouse` | `{}` | `POST /warehouse`, `PUT /warehouse/{id}`, `PATCH /warehouse/{id}`, `DELETE /warehouse/{id}` | +| `supplier` | `{}` | `POST /supplier`, `PATCH /supplier/{id}`, `DELETE /supplier/{id}` | | `vfs` | `{}` | VFS uploads and filesystem mutations such as `POST /vfs/upload`, `POST /vfs/mkdir`, `POST /vfs/rename`, `PUT /vfs/{*path}`, `DELETE /vfs/{*path}` | | `modelconversation` | `{}` | `POST /modelconversation`, `DELETE /modelconversation/{id}` | | `modelconversation-` | `{}` | Conversation-specific updates on the same model conversation thread; the concrete ID is used in the event name | diff --git a/docs/api/routes/supplier/create.md b/docs/api/routes/supplier/create.md index c9cb31e..1d31fdb 100644 --- a/docs/api/routes/supplier/create.md +++ b/docs/api/routes/supplier/create.md @@ -19,6 +19,10 @@ Creates a supplier in the company `Lieferanten` group (created on first use). } ``` +## Signals + +On success, emits SSE signal: `supplier` (see [`GET /events`](../events.md)). + ## Response `201` Created supplier diff --git a/docs/api/routes/supplier/delete.md b/docs/api/routes/supplier/delete.md index 4973698..55f4154 100644 --- a/docs/api/routes/supplier/delete.md +++ b/docs/api/routes/supplier/delete.md @@ -14,6 +14,10 @@ Related `entityhistory` cascades; `manifest.entity_id` is set null. |-------|----------|------|-------------| | `id` | yes | integer | | +## Signals + +On success, emits SSE signal: `supplier` (see [`GET /events`](../events.md)). + ## Response `204` Deleted diff --git a/docs/api/routes/supplier/update.md b/docs/api/routes/supplier/update.md index e75a8a0..e9d2c0a 100644 --- a/docs/api/routes/supplier/update.md +++ b/docs/api/routes/supplier/update.md @@ -24,6 +24,10 @@ Renames a supplier for the selected company. } ``` +## Signals + +On success, emits SSE signal: `supplier` (see [`GET /events`](../events.md)). + ## Response `200` Updated supplier diff --git a/src/api/routes/events.js b/src/api/routes/events.js index 932c665..68967bd 100644 --- a/src/api/routes/events.js +++ b/src/api/routes/events.js @@ -56,6 +56,7 @@ export function register(app, basePath = '') { * | `labeltemplate` | `{}` | `POST /labeltemplate`, `PUT /labeltemplate/{id}`, `PATCH /labeltemplate/{id}`, `DELETE /labeltemplate/{id}` | * | `printer` | `{}` | `POST /printer`, `PUT /printer/{id}`, `PATCH /printer/{id}`, `DELETE /printer/{id}` | * | `warehouse` | `{}` | `POST /warehouse`, `PUT /warehouse/{id}`, `PATCH /warehouse/{id}`, `DELETE /warehouse/{id}` | + * | `supplier` | `{}` | `POST /supplier`, `PATCH /supplier/{id}`, `DELETE /supplier/{id}` | * | `vfs` | `{}` | VFS uploads and filesystem mutations such as `POST /vfs/upload`, `POST /vfs/mkdir`, `POST /vfs/rename`, `PUT /vfs/{*path}`, `DELETE /vfs/{*path}` | * | `modelconversation` | `{}` | `POST /modelconversation`, `DELETE /modelconversation/{id}` | * | `modelconversation-` | `{}` | Conversation-specific updates on the same model conversation thread; the concrete ID is used in the event name | @@ -98,6 +99,8 @@ export function register(app, basePath = '') { * payload: "{}" * - name: warehouse * payload: "{}" + * - name: supplier + * payload: "{}" * - name: vfs * payload: "{}" * - name: modelconversation diff --git a/src/api/routes/supplier.js b/src/api/routes/supplier.js index 6203e46..e7c0a27 100644 --- a/src/api/routes/supplier.js +++ b/src/api/routes/supplier.js @@ -1,4 +1,5 @@ import * as db from '../../db/supplier.js'; +import { emit } from '../sse.js'; // #region Helpers @@ -114,6 +115,7 @@ export function register(app, basePath = '') { * Creates a supplier in the company `Lieferanten` group (created on first use). * security: * - cookieAuth: [] + * x-signals: [supplier] * x-markdown: supplier/create.md * requestBody: * required: true @@ -194,6 +196,7 @@ export function register(app, basePath = '') { try { const supplier = await db.create(req.user.id, { name }); + emit('supplier', { companyId: selected.companyId }); res.status(201).json({ supplier }); } catch (error) { const status = supplierErrorStatus(error); @@ -213,6 +216,7 @@ export function register(app, basePath = '') { * description: Renames a supplier for the selected company. * security: * - cookieAuth: [] + * x-signals: [supplier] * x-markdown: supplier/update.md * parameters: * - in: path @@ -274,6 +278,7 @@ export function register(app, basePath = '') { * Related `entityhistory` cascades; `manifest.entity_id` is set null. * security: * - cookieAuth: [] + * x-signals: [supplier] * x-markdown: supplier/delete.md * parameters: * - in: path @@ -332,6 +337,7 @@ export function register(app, basePath = '') { try { const supplier = await db.update(req.user.id, id, { name }); + emit('supplier', { companyId: selected.companyId }); res.status(200).json({ supplier }); } catch (error) { const status = supplierErrorStatus(error); @@ -357,6 +363,7 @@ export function register(app, basePath = '') { try { await db.remove(req.user.id, id); + emit('supplier', { companyId: selected.companyId }); res.sendStatus(204); } catch (error) { const status = supplierErrorStatus(error);