Files
dashfront/src/api/printer.js
2026-10-10 18:17:14 +02:00

62 lines
1.5 KiB
JavaScript

import { http } from './http.js';
/**
* Company-scoped printers (selectedCompanyId from session).
* Shape: Printer = { id, address, type, model, serial, sort, desc }
*/
export const printer = {
/** GET /api/printer → { printers: Printer[] } */
// #region GET /api/printer — list
list() {
return http('/api/printer');
},
// #endregion
/** GET /api/printer/:id → { printer: Printer } */
// #region GET /api/printer/:id — getById
getById(id) {
return http(`/api/printer/${id}`);
},
// #endregion
/**
* POST /api/printer
* Body: { address, type, model, serial, sort, desc }
* → 201 { printer: Printer }
*/
// #region POST /api/printer — create
create(body) {
return http('/api/printer', { method: 'POST', body });
},
// #endregion
/**
* PATCH /api/printer/:id
* Body: partial printer fields
* → 200 { printer: Printer }
*/
// #region PATCH /api/printer/:id — update
update(id, body) {
return http(`/api/printer/${id}`, { method: 'PATCH', body });
},
// #endregion
/** DELETE /api/printer/:id → 204 */
// #region DELETE /api/printer/:id — delete
delete(id) {
return http(`/api/printer/${id}`, { method: 'DELETE' });
},
// #endregion
/**
* PUT /api/printer/order
* Body: { printerIds: number[] }
* → 200 { printerIds: number[] }
*/
// #region PUT /api/printer/order — order
order({ printerIds }) {
return http('/api/printer/order', { method: 'PUT', body: { printerIds } });
},
// #endregion
};