2020-01-24 08:07:40 +00:00
|
|
|
const roomQueries = require('../../data/queries/room');
|
|
|
|
const messageQueries = require('../../data/queries/message');
|
|
|
|
const gameQueries = require('../../data/queries/game');
|
|
|
|
const moveQueries = require('../../data/queries/move');
|
|
|
|
|
|
|
|
const show = async (req, res, next) => {
|
|
|
|
try {
|
|
|
|
const gameId = req.params.id;
|
|
|
|
if (!gameId) throw('missing game parameter')
|
|
|
|
|
2020-01-26 00:50:18 +00:00
|
|
|
// TODO Promise.all()
|
|
|
|
const game = await gameQueries.findGameById(gameId);
|
2020-05-12 01:18:42 +00:00
|
|
|
// const record = await moveQueries.findGameRecord(gameId);
|
|
|
|
// console.log(record)
|
|
|
|
res.status(200).json({game})
|
2020-01-24 08:07:40 +00:00
|
|
|
}
|
|
|
|
catch (err) {
|
|
|
|
res.status(500).json(err);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
show
|
|
|
|
}
|