u
This commit is contained in:
91
src/api/posterminal.js
Normal file
91
src/api/posterminal.js
Normal file
@@ -0,0 +1,91 @@
|
||||
import { http } from './http.js';
|
||||
|
||||
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 },
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* PATCH /api/posterminal/:id
|
||||
* Body: { name?: string, rootCategoryId?: number|null, syncRootArticles?: boolean, pairingpin?: string }
|
||||
* Update posterminal configuration.
|
||||
* → 200 { posterminal }
|
||||
*/
|
||||
update(terminalId, patch) {
|
||||
return http(`/api/posterminal/${terminalId}`, {
|
||||
method: 'PATCH',
|
||||
body: patch,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 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',
|
||||
});
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user