mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-11-04 08:10:28 +09:00
파일 페이지에 카테고리 목록 및 카테고리에 추가 버튼 구현
This commit is contained in:
1 parent
a2402f37a0
commit
4c0d668cc1
7 files changed
+80
-28
No files matched your search
@@ -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