u
This commit is contained in:
@@ -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}` |
|
||||
|
||||
@@ -490,6 +490,7 @@ _none_
|
||||
- `labeltemplate`: `{}`
|
||||
- `printer`: `{}`
|
||||
- `warehouse`: `{}`
|
||||
- `supplier`: `{}`
|
||||
- `vfs`: `{}`
|
||||
- `modelconversation`: `{}`
|
||||
- `modelconversation-<id>`: `{}`
|
||||
|
||||
@@ -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-<id>` | `{}` | Conversation-specific updates on the same model conversation thread; the concrete ID is used in the event name |
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user