adding in character detail stuff
This commit is contained in:
@@ -80,13 +80,13 @@ app.post('/api/character', jsonParser, async (req, res) => {
|
||||
const count = req.body.count
|
||||
|
||||
const characterData = await Character.findAll({
|
||||
offset: page * count,
|
||||
limit: count
|
||||
offset: page * count,
|
||||
limit: count
|
||||
})
|
||||
const pageCount = Math.ceil(await Character.count() / count)
|
||||
const pageCount = Math.ceil((await Character.count()) / count)
|
||||
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.json({characterData, pageCount})
|
||||
res.json({ characterData, pageCount })
|
||||
})
|
||||
|
||||
app.get('/api/game/:characterId', async (req, res) => {
|
||||
@@ -94,18 +94,21 @@ app.get('/api/game/:characterId', async (req, res) => {
|
||||
})
|
||||
|
||||
app.post('/api/game', jsonParser, async (req, res) => {
|
||||
const page = req.body.page
|
||||
const orderBy = req.body.orderBy
|
||||
const count = req.body.count
|
||||
const page = req.body.page || 0
|
||||
const orderBy = req.body.orderBy || 'id'
|
||||
const count = req.body.count || 10
|
||||
const filter = req.body.filter || ''
|
||||
|
||||
const gameData = await Game.findAll({
|
||||
offset: page * count,
|
||||
limit: count
|
||||
console.log(filter)
|
||||
|
||||
const gameData = await Game.findAll({
|
||||
offset: page * count,
|
||||
limit: count
|
||||
})
|
||||
const pageCount = Math.ceil(await Character.count() / count)
|
||||
const pageCount = Math.ceil((await Character.count()) / count)
|
||||
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.send({gameData, pageCount})
|
||||
res.send({ gameData, pageCount })
|
||||
})
|
||||
|
||||
app.get('/api/game/:gameId', async (req, res) => {
|
||||
|
||||
Reference in New Issue
Block a user