mirror of
https://github.com/diced/zipline.git
synced 2025-04-04 23:21:17 -05:00
fix: cleanup old methods from /api/user/files
This commit is contained in:
parent
3c00575ecd
commit
b21995a0b9
3 changed files with 5 additions and 6 deletions
|
@ -29,7 +29,7 @@ export default function FilePagation({ disableMediaPreview, exifEnabled, queryPa
|
|||
{ shallow: true }
|
||||
);
|
||||
|
||||
const { count } = await useFetch(`/api/user/paged?type=count${!checked ? '&filter=media' : ''}`);
|
||||
const { count } = await useFetch(`/api/user/paged?count=true${!checked ? '&filter=media' : ''}`);
|
||||
setNumPages(count);
|
||||
})();
|
||||
}, [page]);
|
||||
|
|
|
@ -2,7 +2,6 @@ import config from 'lib/config';
|
|||
import datasource from 'lib/datasource';
|
||||
import Logger from 'lib/logger';
|
||||
import prisma from 'lib/prisma';
|
||||
import { chunk } from 'lib/util';
|
||||
import { NextApiReq, NextApiRes, UserExtended, withZipline } from 'middleware/withZipline';
|
||||
|
||||
const logger = Logger.get('files');
|
||||
|
@ -96,7 +95,7 @@ async function handler(req: NextApiReq, res: NextApiRes, user: UserExtended) {
|
|||
if (req.query.filter && req.query.filter === 'media')
|
||||
images = images.filter((x) => /^(video|audio|image|text)/.test(x.mimetype));
|
||||
|
||||
return res.json(req.query.paged ? chunk(images, 16) : images);
|
||||
return res.json(images);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,10 +5,10 @@ import { NextApiReq, NextApiRes, UserExtended, withZipline } from 'middleware/wi
|
|||
const pageCount = 16;
|
||||
|
||||
async function handler(req: NextApiReq, res: NextApiRes, user: UserExtended) {
|
||||
const { page, filter, type, favorite } = req.query as {
|
||||
const { page, filter, count, favorite } = req.query as {
|
||||
page: string;
|
||||
filter: string;
|
||||
type: string;
|
||||
count: string;
|
||||
favorite: string;
|
||||
};
|
||||
|
||||
|
@ -34,7 +34,7 @@ async function handler(req: NextApiReq, res: NextApiRes, user: UserExtended) {
|
|||
}),
|
||||
};
|
||||
|
||||
if (type === 'count') {
|
||||
if (count) {
|
||||
const count = await prisma.image.count({
|
||||
where,
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue