This commit is contained in:
seb
2026-09-26 23:06:09 +02:00
parent cbb2fdeb6d
commit 69f27a2942
19 changed files with 2231 additions and 0 deletions

View File

@@ -80,9 +80,17 @@
"name": "Posterminal",
"description": "Company-scoped POS terminals"
},
{
"name": "Printer",
"description": "Company-scoped receipt and label printers"
},
{
"name": "Ledger",
"description": "Append-only ledger transactions"
},
{
"name": "Stock",
"description": "Manual stock additions and removals"
}
],
"paths": {
@@ -901,6 +909,83 @@
}
}
},
"/stock/adjust": {
"post": {
"tags": [
"Stock"
],
"summary": "Adjust stock manually",
"description": "Writes signed (+ or -) entries to the append-only ledger under an implicit manifest\nof type \"adjustment\", allocating a number from the \"adjustment\" number scheme.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "stock/adjust.md",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StockAdjustmentInput"
}
}
}
},
"responses": {
"201": {
"description": "Stock adjusted successfully",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StockAdjustmentResult"
}
}
}
},
"400": {
"description": "Missing fields, invalid amount, or 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": "Article or warehouse not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/quote": {
"get": {
"tags": [
@@ -1361,6 +1446,560 @@
}
}
},
"/printer": {
"get": {
"tags": [
"Printer"
],
"summary": "List printers",
"description": "Lists printers for the selected company, ordered by sort and id.",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "printer/list.md",
"responses": {
"200": {
"description": "List of printers",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"printers": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Printer"
}
}
}
}
}
}
},
"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"
}
}
}
}
}
},
"post": {
"tags": [
"Printer"
],
"summary": "Create printer",
"description": "Creates a new printer for the selected company.\n`type` must be `\"esc/pos\"` (lines) or `\"zpl\"` (pages).\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "printer/create.md",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PrinterCreateInput"
}
}
}
},
"responses": {
"201": {
"description": "Created printer",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"printer": {
"$ref": "#/components/schemas/Printer"
}
}
}
}
}
},
"400": {
"description": "Invalid input or missing fields",
"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"
}
}
}
}
}
}
},
"/printer/order": {
"put": {
"tags": [
"Printer"
],
"summary": "Reorder printers",
"description": "Reorders printers for the selected company.\n`printerIds` must include all existing printer IDs exactly once.\n",
"security": [
{
"cookieAuth": []
}
],
"x-markdown": "printer/order.md",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"printerIds"
],
"properties": {
"printerIds": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
}
}
},
"responses": {
"200": {
"description": "Applied printer order",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"printerIds": {
"type": "array",
"items": {
"type": "integer"
}
}
}
}
}
}
},
"400": {
"description": "Invalid printer order or 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"
}
}
}
}
}
}
},
"/printer/{id}": {
"get": {
"tags": [
"Printer"
],
"summary": "Get printer by ID",
"description": "Retrieves a single printer for the authenticated user's selected company.",
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
},
"description": "Printer ID"
}
],
"x-markdown": "printer/get.md",
"responses": {
"200": {
"description": "Printer details",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"printer": {
"$ref": "#/components/schemas/Printer"
}
}
}
}
}
},
"400": {
"description": "Invalid ID or 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": "Printer not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"patch": {
"tags": [
"Printer"
],
"summary": "Update printer (partial)",
"description": "Updates specified fields of an existing printer for the selected company.",
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
},
"description": "Printer ID"
}
],
"x-markdown": "printer/update.md",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PrinterUpdateInput"
}
}
}
},
"responses": {
"200": {
"description": "Updated printer",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"printer": {
"$ref": "#/components/schemas/Printer"
}
}
}
}
}
},
"400": {
"description": "Invalid input",
"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": "Printer not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"put": {
"tags": [
"Printer"
],
"summary": "Update printer",
"description": "Updates specified fields of an existing printer for the selected company.",
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
},
"description": "Printer ID"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PrinterUpdateInput"
}
}
}
},
"responses": {
"200": {
"description": "Updated printer",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"printer": {
"$ref": "#/components/schemas/Printer"
}
}
}
}
}
},
"400": {
"description": "Invalid input",
"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": "Printer not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
},
"delete": {
"tags": [
"Printer"
],
"summary": "Delete printer",
"description": "Deletes a printer for the authenticated user's selected company.",
"security": [
{
"cookieAuth": []
}
],
"parameters": [
{
"in": "path",
"name": "id",
"required": true,
"schema": {
"type": "integer"
},
"description": "Printer ID"
}
],
"x-markdown": "printer/delete.md",
"responses": {
"204": {
"description": "Printer deleted"
},
"400": {
"description": "Invalid ID or 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": "Printer not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
},
"/posterminal": {
"get": {
"tags": [
@@ -11071,6 +11710,208 @@
"description": "Transaction memo / details"
}
}
},
"Printer": {
"type": "object",
"required": [
"id",
"company_id",
"address",
"type",
"sort"
],
"properties": {
"id": {
"type": "integer"
},
"company_id": {
"type": "integer"
},
"address": {
"type": "string",
"description": "Printer network address or hostname"
},
"type": {
"type": "string",
"enum": [
"esc/pos",
"zpl"
],
"description": "Printer type (\"esc/pos\" for lines or \"zpl\" for pages)"
},
"model": {
"type": "string",
"nullable": true,
"description": "Printer model name"
},
"serial": {
"type": "string",
"nullable": true,
"description": "Printer serial number"
},
"sort": {
"type": "integer",
"description": "Sort order"
},
"desc": {
"type": "string",
"nullable": true,
"description": "Printer description"
}
}
},
"PrinterCreateInput": {
"type": "object",
"required": [
"address",
"type"
],
"properties": {
"address": {
"type": "string",
"description": "Printer network address or hostname"
},
"type": {
"type": "string",
"enum": [
"esc/pos",
"zpl"
],
"description": "Printer type (\"esc/pos\" for lines or \"zpl\" for pages)"
},
"model": {
"type": "string",
"nullable": true
},
"serial": {
"type": "string",
"nullable": true
},
"sort": {
"type": "integer"
},
"desc": {
"type": "string",
"nullable": true
}
}
},
"PrinterUpdateInput": {
"type": "object",
"properties": {
"address": {
"type": "string"
},
"type": {
"type": "string",
"enum": [
"esc/pos",
"zpl"
]
},
"model": {
"type": "string",
"nullable": true
},
"serial": {
"type": "string",
"nullable": true
},
"sort": {
"type": "integer"
},
"desc": {
"type": "string",
"nullable": true
}
}
},
"StockAdjustmentInput": {
"type": "object",
"properties": {
"sku": {
"type": "string",
"description": "Article SKU (for single-item adjustment)"
},
"warehouseId": {
"type": "integer",
"description": "Target warehouse ID"
},
"amount": {
"type": "number",
"description": "Signed adjustment quantity (+ to add, - to remove)"
},
"text": {
"type": "string",
"nullable": true,
"description": "Reason or memo"
},
"lines": {
"type": "array",
"description": "Batch adjustment lines",
"items": {
"type": "object",
"required": [
"sku",
"amount"
],
"properties": {
"sku": {
"type": "string"
},
"warehouseId": {
"type": "integer"
},
"amount": {
"type": "number"
},
"text": {
"type": "string"
}
}
}
}
}
},
"StockAdjustmentResult": {
"type": "object",
"properties": {
"manifest": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"number": {
"type": "string"
},
"type": {
"type": "string",
"example": "adjustment"
},
"date": {
"type": "string",
"format": "date-time"
},
"createdAt": {
"type": "string",
"format": "date-time"
}
}
},
"lines": {
"type": "array",
"items": {
"type": "object"
}
},
"ledger": {
"type": "array",
"items": {
"$ref": "#/components/schemas/LedgerEntry"
}
}
}
}
}
}