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

42
src/api/labeltemplate.js Normal file
View File

@@ -0,0 +1,42 @@
import { http } from './http.js';
/**
* Company-scoped ZPL label templates (selectedCompanyId from session).
* Shape: LabelTemplate = { id, company_id, name, width, height, dpi, type, content, thumb }
*/
export const labeltemplate = {
/** GET /api/labeltemplate → { labeltemplates: LabelTemplate[] } */
list() {
return http('/api/labeltemplate');
},
/** GET /api/labeltemplate/:id → { labeltemplate: LabelTemplate } */
get(id) {
return http(`/api/labeltemplate/${encodeURIComponent(id)}`);
},
/**
* POST /api/labeltemplate
* Body: { name, width, height, dpi, type, content }
* → 201 { labeltemplate: LabelTemplate }
*/
create(body) {
return http('/api/labeltemplate', { method: 'POST', body });
},
/**
* PATCH /api/labeltemplate/:id
* Body: partial { name?, width?, height?, dpi?, type?, content? }
* → 200 { labeltemplate: LabelTemplate }
*/
update(id, body) {
return http(`/api/labeltemplate/${encodeURIComponent(id)}`, { method: 'PATCH', body });
},
/** DELETE /api/labeltemplate/:id → 204 */
delete(id) {
return http(`/api/labeltemplate/${encodeURIComponent(id)}`, { method: 'DELETE' });
},
// thumb is returned inline as a base64 string in list/get responses
};