This commit is contained in:
seb
2026-08-03 07:13:42 +02:00
parent 4db4948090
commit f302eb9e67
9 changed files with 985 additions and 51 deletions

View File

@@ -371,6 +371,20 @@ export const category = {
body: { parentId },
});
},
/**
* PATCH /api/category/:id
* Body: { pos: boolean } — toggles the POS (Point of Sale) flag.
* → 200 { category: { id, pos } }
*
* PROPOSED — backend needs to implement this field.
*/
updatePos(categoryId, pos) {
return http(`/api/category/${categoryId}`, {
method: 'PATCH',
body: { pos },
});
},
};
/**
@@ -437,6 +451,83 @@ export const company = {
},
};
export const posterminal = {
/**
* GET /api/posterminal → { posterminals: [{ id, name, token, pairingpin }] }
* List all terminals for the selected company.
*/
list() {
return http('/api/posterminal');
},
/**
* PUT /api/posterminal
* Body: { name: string }
* Creates a new terminal (auto-generates 6-digit pin).
* → 200 { posterminal: { id, name, token, pairingpin } }
*/
create({ name }) {
return http('/api/posterminal', {
method: 'PUT',
body: { name },
});
},
/**
* DELETE /api/posterminal/:id → 204
* Deletes a terminal.
*/
delete(terminalId) {
return http(`/api/posterminal/${terminalId}`, {
method: 'DELETE',
});
},
/**
* PUT /api/posterminal/:id/category/:categoryId
* Enable a category on a terminal.
* → 200 { id: number, categoryIds: number[] }
*/
enableCategory(terminalId, categoryId) {
return http(`/api/posterminal/${terminalId}/category/${categoryId}`, {
method: 'PUT',
});
},
/**
* DELETE /api/posterminal/:id/category/:categoryId
* Disable a category on a terminal.
* → 200 { id: number, categoryIds: number[] }
*/
disableCategory(terminalId, categoryId) {
return http(`/api/posterminal/${terminalId}/category/${categoryId}`, {
method: 'DELETE',
});
},
/**
* PUT /api/posterminal/:id/all
* Enable all categories on a terminal.
* → 200 { id: number, categoryIds: number[] }
*/
enableAllCategories(terminalId) {
return http(`/api/posterminal/${terminalId}/all`, {
method: 'PUT',
});
},
/**
* DELETE /api/posterminal/:id/all
* Disable all categories on a terminal.
* → 200 { id: number, categoryIds: number[] }
*/
disableAllCategories(terminalId) {
return http(`/api/posterminal/${terminalId}/all`, {
method: 'DELETE',
});
},
};
export const auth = {
async me() {
try {
@@ -488,4 +579,4 @@ export const auth = {
},
};
export default { auth, article, brand, category, company, thumb, unit };
export default { auth, article, brand, category, company, posterminal, thumb, unit };