This commit is contained in:
seb
2026-10-10 00:39:23 +02:00
parent 2c36a705c4
commit ff54fe3a18
30 changed files with 2250 additions and 2256 deletions

49
src/api/printer.js Normal file
View File

@@ -0,0 +1,49 @@
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[] } */
list() {
return http('/api/printer');
},
/** GET /api/printer/:id → { printer: Printer } */
getById(id) {
return http(`/api/printer/${id}`);
},
/**
* POST /api/printer
* Body: { address, type, model, serial, sort, desc }
* → 201 { printer: Printer }
*/
create(body) {
return http('/api/printer', { method: 'POST', body });
},
/**
* PATCH /api/printer/:id
* Body: partial printer fields
* → 200 { printer: Printer }
*/
update(id, body) {
return http(`/api/printer/${id}`, { method: 'PATCH', body });
},
/** DELETE /api/printer/:id → 204 */
delete(id) {
return http(`/api/printer/${id}`, { method: 'DELETE' });
},
/**
* PUT /api/printer/order
* Body: { printerIds: number[] }
* → 200 { printerIds: number[] }
*/
order({ printerIds }) {
return http('/api/printer/order', { method: 'PUT', body: { printerIds } });
},
};