Add supplier CRUD on entity with Lieferanten group and entityhistory
This commit is contained in:
19
README.md
19
README.md
@@ -187,6 +187,21 @@ Company-scoped brands. Auth via `resolveCompanyAccess`.
|
||||
|
||||
---
|
||||
|
||||
## `supplier`
|
||||
|
||||
Suppliers are `entity` rows in the company `customergroup` named `Lieferanten` (created implicitly on first supplier). Auth via `resolveCompanyAccess`.
|
||||
|
||||
| Method | Signature | Returns |
|
||||
| --- | --- | --- |
|
||||
| `list` | `(googleAuthId, companyId)` | `{ id, name, createdAt, updatedAt }[]` |
|
||||
| `create` | `(googleAuthId, companyId, { name })` | `{ id, name, createdAt, updatedAt }` |
|
||||
| `update` | `(googleAuthId, companyId, id, { name })` | `{ id, name, createdAt, updatedAt }` |
|
||||
| `delete` | `(googleAuthId, companyId, id)` | `void` |
|
||||
|
||||
`create` ensures `customergroup` `Lieferanten` for the company, inserts `entity` (`name` only; `first_name` null), writes `entityhistory` (`Erstellt`) with the auth `companyuser_id`. `update` renames and writes `Name geändert von "…" auf "…"` when the name actually changes; bumps `updated_at`. Empty name → `Name required`. `delete` removes the entity (`entityhistory` cascades; `manifest.entity_id` set null). Errors: `Company not found`, `Not authorized`, `Name required`, `Supplier not found`.
|
||||
|
||||
---
|
||||
|
||||
## `posterminal`
|
||||
|
||||
Company-scoped POS terminals. Auth via `resolveCompanyAccess`.
|
||||
@@ -460,6 +475,10 @@ res.set('Content-Type', thumb.contentType).send(thumb.buffer);
|
||||
| `GET /api/brand` | `brand.list(googleAuthId, companyId)` |
|
||||
| `PUT /api/brand` | `brand.upsert(googleAuthId, companyId, { name, gsprpinfo? })` |
|
||||
| `DELETE /api/brand/:id` | `brand.delete(googleAuthId, companyId, id)` |
|
||||
| `GET /api/supplier` | `supplier.list(googleAuthId, companyId)` |
|
||||
| `POST /api/supplier` | `supplier.create(googleAuthId, companyId, { name })` |
|
||||
| `PATCH /api/supplier/:id` | `supplier.update(googleAuthId, companyId, id, { name })` |
|
||||
| `DELETE /api/supplier/:id` | `supplier.delete(googleAuthId, companyId, id)` |
|
||||
| `GET /api/posterminal` | `posterminal.list(googleAuthId, companyId)` |
|
||||
| `PUT /api/posterminal` | `posterminal.upsert(googleAuthId, companyId, { id?, name, token?, pairingpin })` |
|
||||
| `DELETE /api/posterminal/:id` | `posterminal.delete(googleAuthId, companyId, id)` |
|
||||
|
||||
Reference in New Issue
Block a user