mirror of
https://github.com/kmc7468/arkvault.git
synced 2025-12-16 23:18:48 +00:00
파일 페이지에 카테고리 목록 및 카테고리에 추가 버튼 구현
This commit is contained in:
@@ -441,6 +441,15 @@ export const addFileToCategory = async (fileId: number, categoryId: number) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const getAllFileCategories = async (fileId: number) => {
|
||||
const categories = await db
|
||||
.selectFrom("file_category")
|
||||
.select("category_id")
|
||||
.where("file_id", "=", fileId)
|
||||
.execute();
|
||||
return categories.map(({ category_id }) => ({ id: category_id }));
|
||||
};
|
||||
|
||||
export const removeFileFromCategory = async (fileId: number, categoryId: number) => {
|
||||
await db.transaction().execute(async (trx) => {
|
||||
const res = await trx
|
||||
|
||||
Reference in New Issue
Block a user