Add customergroup sort with bulk order and locked implicit names.
Reorder via customergroup.order (exact id list → sort 0…n-1); block renaming POS/Lieferanten while still allowing create/update of other groups by name.
This commit is contained in:
12
README.md
12
README.md
@@ -193,12 +193,15 @@ Company-scoped customer groups. Auth via `resolveCompanyAccess`.
|
||||
|
||||
| Method | Signature | Returns |
|
||||
| --- | --- | --- |
|
||||
| `list` | `(googleAuthId, companyId)` | `{ id, name }[]` |
|
||||
| `create` | `(googleAuthId, companyId, { name })` | `{ id, name }` |
|
||||
| `update` | `(googleAuthId, companyId, id, { name })` | `{ id, name }` |
|
||||
| `list` | `(googleAuthId, companyId)` | `{ id, name, sort }[]` |
|
||||
| `create` | `(googleAuthId, companyId, { name })` | `{ id, name, sort }` |
|
||||
| `update` | `(googleAuthId, companyId, id, { name })` | `{ id, name, sort }` |
|
||||
| `order` | `(googleAuthId, companyId, { customergroupIds })` | `{ customergroupIds }` |
|
||||
| `delete` | `(googleAuthId, companyId, id)` | `void` |
|
||||
|
||||
Empty name → `Name required`. Deleting the POS group (or any group still referenced with `NO ACTION`) → `Customer group in use`. Cascades entities when the group is deleted. Errors: `Company not found`, `Not authorized`, `Name required`, `Customer group not found`, `Customer group in use`.
|
||||
List ordered by `sort`, `name`, `id`. `create` appends with next `sort` (`0…n`). `order` sets `sort` to each id’s index `0…n-1`; `customergroupIds` must be exactly the company’s groups (same set, no dups) else `Invalid customer group order`. Implicit groups `POS` (company create) and `Lieferanten` (first supplier) cannot be renamed (`Name cannot be changed`). Creating a group with those reserved names → `Name not allowed`.
|
||||
|
||||
Empty name → `Name required`. Deleting the POS group (or any group still referenced with `NO ACTION`) → `Customer group in use`. Cascades entities when the group is deleted. Errors: `Company not found`, `Not authorized`, `Name required`, `Name not allowed`, `Name cannot be changed`, `Invalid customer group order`, `Customer group not found`, `Customer group in use`.
|
||||
|
||||
---
|
||||
|
||||
@@ -682,6 +685,7 @@ res.set('Content-Type', thumb.contentType).send(thumb.buffer);
|
||||
| `GET /api/customergroup` | `customergroup.list(googleAuthId, companyId)` |
|
||||
| `POST /api/customergroup` | `customergroup.create(googleAuthId, companyId, { name })` |
|
||||
| `PATCH /api/customergroup/:id` | `customergroup.update(googleAuthId, companyId, id, { name })` |
|
||||
| `PUT /api/customergroup/order` | `customergroup.order(googleAuthId, companyId, { customergroupIds })` |
|
||||
| `DELETE /api/customergroup/:id` | `customergroup.delete(googleAuthId, companyId, id)` |
|
||||
| `GET /api/entity` | `entity.list(googleAuthId, companyId, { customergroupId?, role? })` |
|
||||
| `GET /api/entity/:id` | `entity.getById(googleAuthId, companyId, id)` |
|
||||
|
||||
Reference in New Issue
Block a user