Update the character list to use the server side table stuff

This commit is contained in:
iamBadgers committed 2024-06-09 19:11:41 -07:00
1 parent aa4f17df06
commit 1544117aae
5 files changed
+65 -47

No files matched your search

+5 -4
View File
@@ -33,14 +33,15 @@ export function addCharacterApis(app, jsonParser) {
order: orderBy,
where: filter
})
const pageCount = Math.ceil(
(await Character.count({
const totalCount = await Character.count({
where: filter
})) / count
})
const pageCount = Math.ceil(
totalCount / count
)
res.setHeader('Content-Type', 'application/json')
res.send({ characterData, pageCount })
res.send({ characterData, pageCount, totalCount })
} catch (e) {
if (e instanceof ParsingError) {
res.status(400).send('Could not parse filter.')