This commit is contained in:
seb
2026-10-28 23:09:50 +01:00
parent dc9fcdad96
commit 158748c5e6
8 changed files with 25 additions and 0 deletions

View File

@@ -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-<id>` | `{}` | 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

View File

@@ -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);