카테고리 목록에서 파일 목록을 재귀적으로 표시할 수 있는 기능 구현

This commit is contained in:
static
2025-01-22 22:24:44 +09:00
parent 8f8bad6d10
commit f34764ffe0
9 changed files with 98 additions and 41 deletions

View File

@@ -66,14 +66,14 @@ export const addCategoryFile = async (userId: number, categoryId: number, fileId
}
};
export const getCategoryFiles = async (userId: number, categoryId: number) => {
export const getCategoryFiles = async (userId: number, categoryId: number, recursive: boolean) => {
const category = await getCategory(userId, categoryId);
if (!category) {
error(404, "Invalid category id");
}
const files = await getAllFilesByCategory(userId, categoryId);
return { files: files.map(({ id }) => id) };
const files = await getAllFilesByCategory(userId, categoryId, recursive);
return { files };
};
export const removeCategoryFile = async (userId: number, categoryId: number, fileId: number) => {