u
This commit is contained in:
@@ -15,6 +15,7 @@ export { number } from './number.js';
|
||||
export { order } from './order.js';
|
||||
export { posterminal } from './posterminal.js';
|
||||
export { printer } from './printer.js';
|
||||
export { printeragent } from './printeragent.js';
|
||||
export { propertyname } from './propertyname.js';
|
||||
export { quote } from './quote.js';
|
||||
export { retoure } from './retoure.js';
|
||||
|
||||
57
src/api/printeragent.js
Normal file
57
src/api/printeragent.js
Normal file
@@ -0,0 +1,57 @@
|
||||
import { http } from './http.js';
|
||||
|
||||
export const printeragent = {
|
||||
/**
|
||||
* GET /api/printeragent → { printeragents: Printeragent[] }
|
||||
* List all printer agents for the selected company, sorted by sort ASC, id ASC.
|
||||
*/
|
||||
list() {
|
||||
return http('/api/printeragent');
|
||||
},
|
||||
|
||||
/**
|
||||
* PUT /api/printeragent
|
||||
* Body: { name: string, sort?: number }
|
||||
* Creates a new printer agent (auto-generates 6-digit pairingpin).
|
||||
* → 200 { printeragent: Printeragent }
|
||||
*/
|
||||
create({ name, sort } = {}) {
|
||||
const body = { name };
|
||||
if (sort !== undefined && sort !== null && sort !== '') {
|
||||
body.sort = Number(sort);
|
||||
}
|
||||
return http('/api/printeragent', {
|
||||
method: 'PUT',
|
||||
body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* PATCH /api/printeragent/:id
|
||||
* Body: { name?: string, sort?: number }
|
||||
* Updates name, sort, or both.
|
||||
* → 200 { printeragent: Printeragent }
|
||||
*/
|
||||
update(id, patch = {}) {
|
||||
const body = {};
|
||||
if (patch.name !== undefined) body.name = patch.name;
|
||||
if (patch.sort !== undefined && patch.sort !== null && patch.sort !== '') {
|
||||
body.sort = Number(patch.sort);
|
||||
}
|
||||
return http(`/api/printeragent/${id}`, {
|
||||
method: 'PATCH',
|
||||
body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* DELETE /api/printeragent/:id → 204 No Content
|
||||
* Permanently deletes agent.
|
||||
*/
|
||||
delete(id) {
|
||||
return http(`/api/printeragent/${id}`, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user