u
This commit is contained in:
@@ -9,6 +9,7 @@ export const brand = {
|
||||
* GET /api/brand → { brands: Brand[], total, offset, limit }
|
||||
* @param {{ offset?: number, limit?: number, includeSmallThumbs?: boolean }} [params]
|
||||
*/
|
||||
// #region GET /api/brand — list
|
||||
list(params) {
|
||||
const offset = Number(params?.offset ?? 0);
|
||||
const limit = Number(params?.limit ?? 0);
|
||||
@@ -20,6 +21,7 @@ export const brand = {
|
||||
const qs = query.toString();
|
||||
return http(qs ? `/api/brand?${qs}` : '/api/brand');
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* POST /api/brand
|
||||
@@ -27,32 +29,39 @@ export const brand = {
|
||||
* Empty name ⇒ 400 Invalid brand.
|
||||
* → 201 { brand: Brand } · 409 Brand already exists
|
||||
*/
|
||||
// #region POST /api/brand — create
|
||||
create(body) {
|
||||
return http('/api/brand', { method: 'POST', body });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* PATCH /api/brand/:id
|
||||
* Body: { name, gsprpinfo? } — rename / update info.
|
||||
* → 200 { id, name, gsprpinfo, touchedArticleCount } · 404 Brand not found
|
||||
*/
|
||||
// #region PATCH /api/brand/:id — rename
|
||||
rename(id, body) {
|
||||
return http(`/api/brand/${encodeURIComponent(id)}`, { method: 'PATCH', body });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* DELETE /api/brand/:id
|
||||
* → 204 No Content · 404 Brand not found
|
||||
*/
|
||||
// #region DELETE /api/brand/:id — delete
|
||||
delete(id) {
|
||||
return http(`/api/brand/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* POST /api/brand/:id/image
|
||||
* Accepts full-size image body (Content-Type: image/webp).
|
||||
* → 201 { brand: { id, fullHash, thumbW, thumbH, thumbHash, pics } }
|
||||
*/
|
||||
// #region POST /api/brand/:id/image — addImage
|
||||
addImage(brandId, file) {
|
||||
return httpBinary(`/api/brand/${brandId}/image`, {
|
||||
method: 'POST',
|
||||
@@ -60,12 +69,15 @@ export const brand = {
|
||||
body: file,
|
||||
});
|
||||
},
|
||||
// #endregion
|
||||
|
||||
/**
|
||||
* DELETE /api/brand/:id/image
|
||||
* → 200 { brand: { id, thumbW: null, thumbH: null, thumbHash: null, pics: [] } }
|
||||
*/
|
||||
// #region DELETE /api/brand/:id/image — deleteImage
|
||||
deleteImage(brandId) {
|
||||
return http(`/api/brand/${brandId}/image`, { method: 'DELETE' });
|
||||
},
|
||||
// #endregion
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user