mirror of
https://github.com/diced/zipline.git
synced 2026-06-12 10:51:17 -07:00
fix: folder files not showing anything
This commit is contained in:
@@ -31,7 +31,7 @@ export default typedPlugin(
|
||||
sortBy: true,
|
||||
order: true,
|
||||
})
|
||||
.partial(),
|
||||
.partial({ page: true }),
|
||||
response: {
|
||||
200: z.object({
|
||||
folder: folderSchema.partial(),
|
||||
@@ -69,7 +69,8 @@ export default typedPlugin(
|
||||
if (!folder) throw new ApiError(9002);
|
||||
if (!folder.public && !folder.allowUploads) throw new ApiError(9002);
|
||||
|
||||
if (folder.allowUploads) {
|
||||
const { page, perpage, sortBy, order } = req.query;
|
||||
if (!page && folder.allowUploads) {
|
||||
return res.send({
|
||||
folder: {
|
||||
id: folder.id,
|
||||
@@ -83,11 +84,6 @@ export default typedPlugin(
|
||||
});
|
||||
}
|
||||
|
||||
const { page, perpage, sortBy, order } = req.query;
|
||||
if (!page || !perpage || !sortBy || !order) {
|
||||
throw new ApiError(1001, 'Missing pagination or sorting parameters');
|
||||
}
|
||||
|
||||
const where = { folderId: folder.id };
|
||||
const total = await prisma.file.count({ where });
|
||||
const pages = total === 0 ? 0 : Math.ceil(total / perpage);
|
||||
|
||||
Reference in New Issue
Block a user