Align store calls with selected-company scoping and add entity numbers.

Drop companyId from company-scoped store wrappers and routes, add GET /entity/next-number plus optional number on entity create/update, and document dashdbschema API.md lookup in sibling-repos.
This commit is contained in:
seb
2026-08-07 06:22:13 +02:00
parent 2767568f5a
commit e6c24654dd
36 changed files with 496 additions and 189 deletions

View File

@@ -3299,7 +3299,7 @@
"Entity"
],
"summary": "List entities",
"description": "Lists entities for the selected company. Optional `customergroupId`\nquery filters to one group (must belong to the company).\n",
"description": "Lists entities for the selected company. Optional `customergroupId`\nfilters to one group. Optional `role=customer` excludes Lieferanten/POS\ngroups (for quote/order pickers). `role` wins when both are set.\n",
"security": [
{
"cookieAuth": []
@@ -3314,6 +3314,17 @@
"schema": {
"type": "integer"
}
},
{
"in": "query",
"name": "role",
"required": false,
"schema": {
"type": "string",
"enum": [
"customer"
]
}
}
],
"responses": {
@@ -3336,7 +3347,7 @@
}
},
"400": {
"description": "No company selected or invalid customergroupId",
"description": "No company selected, invalid customergroupId, or invalid role",
"content": {
"application/json": {
"schema": {
@@ -3382,7 +3393,7 @@
"Entity"
],
"summary": "Create entity",
"description": "Creates an entity in a company customer group and writes `entityhistory` (`Erstellt`).\n",
"description": "Creates an entity in a company customer group and writes `entityhistory` (`Erstellt`).\nOptional `number`: omit to allocate the next customer number (`type` entity).\n",
"security": [
{
"cookieAuth": []
@@ -3409,12 +3420,17 @@
"firstName": {
"type": "string",
"nullable": true
},
"number": {
"type": "string",
"description": "Customer number; omit to auto-allocate"
}
},
"example": {
"customergroupId": 1,
"name": "Müller",
"firstName": "Anna"
"firstName": "Anna",
"number": "10042"
}
}
}
@@ -3437,7 +3453,7 @@
}
},
"400": {
"description": "Name required or no company selected",
"description": "Name/number required or no company selected",
"content": {
"application/json": {
"schema": {
@@ -3475,6 +3491,94 @@
}
}
}
},
"409": {
"description": "Number already in use",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/entity/next-number": {
"get": {
"tags": [
"Entity"
],
"summary": "Peek next customer number",
"description": "Returns the next customer number that would be allocated (`type` entity)\nwithout consuming it. Use on the customer add form.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "entity/next-number.md",
"responses": {
"200": {
"description": "Next number",
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"number"
],
"properties": {
"number": {
"type": "string"
}
}
},
"example": {
"number": "1"
}
}
}
},
"400": {
"description": "No company selected",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"403": {
"description": "Not authorized",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"404": {
"description": "Company not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
@@ -3565,7 +3669,7 @@
"Entity"
],
"summary": "Update entity",
"description": "Patches `name` and/or `firstName`. Writes `entityhistory` when values change.\n",
"description": "Patches fields that are present (`name`, `firstName`, `number`).\n`number` is only changed when the key is present (no auto-allocate).\nWrites `entityhistory` when values change.\n",
"security": [
{
"cookieAuth": []
@@ -3595,11 +3699,16 @@
"firstName": {
"type": "string",
"nullable": true
},
"number": {
"type": "string",
"nullable": true
}
},
"example": {
"name": "Müller",
"firstName": "Anna"
"firstName": "Anna",
"number": "10042"
}
}
}
@@ -3622,7 +3731,7 @@
}
},
"400": {
"description": "Name required, invalid id, or no company selected",
"description": "Name/number required, invalid id, or no company selected",
"content": {
"application/json": {
"schema": {
@@ -3660,6 +3769,16 @@
}
}
}
},
"409": {
"description": "Number already in use",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
@@ -8070,6 +8189,7 @@
"customergroupId",
"firstName",
"name",
"number",
"createdAt",
"updatedAt"
],
@@ -8087,6 +8207,11 @@
"name": {
"type": "string"
},
"number": {
"type": "string",
"nullable": true,
"description": "Customer number (null for suppliers)"
},
"createdAt": {
"type": "string",
"format": "date-time"