Files
dashback/src/db/category.js
seb a3f8ff0e93 feat: add category image upload/delete endpoints
- POST /category/:id/image - upload AVIF image for a category
- DELETE /category/:id/image - remove category image
- Returns { category: { id, fullHash, thumbW, thumbH, thumbHash } }
- Full image stored as-is when AVIF ≤1000x1000, otherwise scaled
- Thumb always scaled to max 200x200
2026-08-03 07:38:38 +02:00

47 lines
1.6 KiB
JavaScript

import { getStore } from './store.js';
export async function getTreeForCompany(googleAuthId, companyId) {
const store = await getStore();
return store.category.getTreeForCompany(googleAuthId, companyId);
}
export async function createUnderParent({ googleAuthId, parentId, name }) {
const store = await getStore();
return store.category.createUnderParent({ googleAuthId, parentId, name });
}
export async function deleteCategory({ googleAuthId, id }) {
const store = await getStore();
await store.category.delete({ googleAuthId, id });
}
export async function getCategoryArticles(googleAuthId, categoryId) {
const store = await getStore();
return store.category.getCategoryArticles(googleAuthId, categoryId);
}
export async function rename({ googleAuthId, id, name }) {
const store = await getStore();
return store.category.rename({ googleAuthId, id, name });
}
export async function order({ googleAuthId, parentId, categoryIds }) {
const store = await getStore();
return store.category.order({ googleAuthId, parentId, categoryIds });
}
export async function move({ googleAuthId, id, parentId }) {
const store = await getStore();
return store.category.move({ googleAuthId, id, parentId });
}
export async function addImage(googleAuthId, categoryId, imageBuffer) {
const store = await getStore();
return store.category.addImage(googleAuthId, categoryId, imageBuffer);
}
export async function deleteImage(googleAuthId, categoryId) {
const store = await getStore();
return store.category.deleteImage(googleAuthId, categoryId);
}