This commit is contained in:
seb
2026-10-10 18:17:14 +02:00
parent 004e0de869
commit a20668cd61
31 changed files with 572 additions and 76 deletions

View File

@@ -6,37 +6,46 @@ import { http } from './http.js';
*/
export const supplier = {
/** GET /api/supplier → { suppliers: Supplier[] } */
// #region GET /api/supplier — list
list() {
return http('/api/supplier');
},
// #endregion
/**
* POST /api/supplier
* Body: { name } — empty name ⇒ 400 Name required.
* → 201 { supplier: Supplier }
*/
// #region POST /api/supplier — create
create(body) {
return http('/api/supplier', { method: 'POST', body });
},
// #endregion
/**
* PATCH /api/supplier/:id
* Body: { name } — empty name ⇒ 400 Name required.
* → 200 { supplier: Supplier }
*/
// #region PATCH /api/supplier/:id — update
update(id, body) {
return http(`/api/supplier/${id}`, { method: 'PATCH', body });
},
// #endregion
/** DELETE /api/supplier/:id → 204 */
// #region DELETE /api/supplier/:id — delete
delete(id) {
return http(`/api/supplier/${id}`, { method: 'DELETE' });
},
// #endregion
/**
* GET /api/supplier/:id/articles?skus=...
* → 200 { articles: SupplierArticle[] }
*/
// #region GET /api/supplier/:id/articles — getArticles
getArticles(id, skus) {
let query = '';
if (skus != null) {
@@ -48,4 +57,5 @@ export const supplier = {
}
return http(`/api/supplier/${encodeURIComponent(id)}/articles${query}`);
},
// #endregion
};