setup the dm apis
This commit is contained in:
@@ -5,7 +5,7 @@ export function addCharacterApis(app, jsonParser) {
|
||||
app.get('/api/character/:characterId', async (req, res) => {
|
||||
try {
|
||||
const character = await Character.findOne({
|
||||
attributes: ["id", "characterName", "playerName", "role", "creationDate", "status"],
|
||||
attributes: ['id', 'characterName', 'playerName', 'role', 'creationDate', 'status'],
|
||||
where: { id: req.params['characterId'] }
|
||||
})
|
||||
if (character) {
|
||||
@@ -35,11 +35,9 @@ export function addCharacterApis(app, jsonParser) {
|
||||
where: filter
|
||||
})
|
||||
const totalCount = await Character.count({
|
||||
where: filter
|
||||
})
|
||||
const pageCount = Math.ceil(
|
||||
totalCount / count
|
||||
)
|
||||
where: filter
|
||||
})
|
||||
const pageCount = Math.ceil(totalCount / count)
|
||||
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.send({ characterData, pageCount, totalCount })
|
||||
|
||||
Reference in New Issue
Block a user