u
This commit is contained in:
49
src/api/printer.js
Normal file
49
src/api/printer.js
Normal 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 } });
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user