Compare commits
2 Commits
36a135011f
...
76235b0e1f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76235b0e1f | ||
|
|
a6cb52e415 |
@@ -690,10 +690,10 @@ _none_
|
|||||||
#### Enable all categories on terminal — `PUT /posterminal/{id}/all`
|
#### Enable all categories on terminal — `PUT /posterminal/{id}/all`
|
||||||
- Params: `id: int`
|
- Params: `id: int`
|
||||||
- Returns: `200 { id: int, categoryIds: int[] }`
|
- Returns: `200 { id: int, categoryIds: int[] }`
|
||||||
#### Disable category on terminal — `DELETE /posterminal/{id}/category/{categoryId}`
|
#### Disable category and subcategories on terminal — `DELETE /posterminal/{id}/category/{categoryId}`
|
||||||
- Params: `id: int, categoryId: int`
|
- Params: `id: int, categoryId: int`
|
||||||
- Returns: `200 { id: int, categoryIds: int[] }`
|
- Returns: `200 { id: int, categoryIds: int[] }`
|
||||||
#### Enable category on terminal — `PUT /posterminal/{id}/category/{categoryId}`
|
#### Enable category and subcategories on terminal — `PUT /posterminal/{id}/category/{categoryId}`
|
||||||
- Params: `id: int, categoryId: int`
|
- Params: `id: int, categoryId: int`
|
||||||
- Returns: `200 { id: int, categoryIds: int[] }`
|
- Returns: `200 { id: int, categoryIds: int[] }`
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||||
|
|
||||||
Disable category on terminal
|
Disable category and subcategories on terminal
|
||||||
|
|
||||||
Removes a single category's visibility on a terminal (idempotent).
|
Removes a category and all its descendant subcategories from a terminal (idempotent).
|
||||||
|
|
||||||
## Path parameters
|
## Path parameters
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||||
|
|
||||||
Enable category on terminal
|
Enable category and subcategories on terminal
|
||||||
|
|
||||||
Toggles a single category's visibility on a terminal (idempotent).
|
Enables a category and all its descendant subcategories on a terminal (idempotent).
|
||||||
|
|
||||||
## Path parameters
|
## Path parameters
|
||||||
|
|
||||||
|
|||||||
@@ -402,8 +402,8 @@ export function register(app, basePath = '') {
|
|||||||
* /posterminal/{id}/category/{categoryId}:
|
* /posterminal/{id}/category/{categoryId}:
|
||||||
* put:
|
* put:
|
||||||
* tags: [Posterminal]
|
* tags: [Posterminal]
|
||||||
* summary: Enable category on terminal
|
* summary: Enable category and subcategories on terminal
|
||||||
* description: Toggles a single category's visibility on a terminal (idempotent).
|
* description: Enables a category and all its descendant subcategories on a terminal (idempotent).
|
||||||
* security:
|
* security:
|
||||||
* - cookieAuth: []
|
* - cookieAuth: []
|
||||||
* x-markdown: posterminal/setOn.md
|
* x-markdown: posterminal/setOn.md
|
||||||
@@ -458,8 +458,8 @@ export function register(app, basePath = '') {
|
|||||||
* $ref: '#/components/schemas/Error'
|
* $ref: '#/components/schemas/Error'
|
||||||
* delete:
|
* delete:
|
||||||
* tags: [Posterminal]
|
* tags: [Posterminal]
|
||||||
* summary: Disable category on terminal
|
* summary: Disable category and subcategories on terminal
|
||||||
* description: Removes a single category's visibility on a terminal (idempotent).
|
* description: Removes a category and all its descendant subcategories from a terminal (idempotent).
|
||||||
* security:
|
* security:
|
||||||
* - cookieAuth: []
|
* - cookieAuth: []
|
||||||
* x-markdown: posterminal/setOff.md
|
* x-markdown: posterminal/setOff.md
|
||||||
|
|||||||
@@ -301,8 +301,21 @@ export async function handleOrder(req, res, next) {
|
|||||||
// 7. Deliver / Shipment
|
// 7. Deliver / Shipment
|
||||||
const shouldDeliver = String(order.settings?.deliver ?? '').trim() === '1' || order.deliver === true || order.shipped === true;
|
const shouldDeliver = String(order.settings?.deliver ?? '').trim() === '1' || order.deliver === true || order.shipped === true;
|
||||||
if (shouldDeliver) {
|
if (shouldDeliver) {
|
||||||
const warehouses = await store.warehouse.list(googleAuthId).catch(() => []);
|
let warehouses = await store.warehouse.list(googleAuthId).catch(() => []);
|
||||||
const defaultWarehouseId = warehouses[0]?.id || 1;
|
let defaultWarehouseId = warehouses[0]?.id;
|
||||||
|
if (!defaultWarehouseId) {
|
||||||
|
try {
|
||||||
|
const createdWh = await store.warehouse.create(googleAuthId, { name: 'Standardlager' });
|
||||||
|
defaultWarehouseId = createdWh.id;
|
||||||
|
emit('warehouse', { companyId });
|
||||||
|
} catch {
|
||||||
|
warehouses = await store.warehouse.list(googleAuthId).catch(() => []);
|
||||||
|
defaultWarehouseId = warehouses[0]?.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!defaultWarehouseId) {
|
||||||
|
throw new Error('Warehouse not found');
|
||||||
|
}
|
||||||
|
|
||||||
const shippableLines = (createdOrder.lines || lines)
|
const shippableLines = (createdOrder.lines || lines)
|
||||||
.filter((l) => l.shippable !== false)
|
.filter((l) => l.shippable !== false)
|
||||||
|
|||||||
Reference in New Issue
Block a user