patch no-query bug in rooms/ endpoint
This commit is contained in:
parent
0a66d3f93c
commit
015be6ca6b
5 changed files with 13 additions and 3 deletions
|
@ -5,6 +5,8 @@ const {enableRoomSocket} = require('../../socket');
|
|||
|
||||
const getAll = async (req, res, next) => {
|
||||
try {
|
||||
const publicRooms = await roomQueries.findPublicRooms();
|
||||
|
||||
res.status(200).json({rooms: [...publicRooms]})
|
||||
}
|
||||
|
||||
|
@ -17,7 +19,6 @@ const show = async (req, res, next) => {
|
|||
try {
|
||||
const roomId = req.params.id;
|
||||
// TODO eventually add check for user's private rooms
|
||||
const publicRooms = await roomQueries.findPublicRooms();
|
||||
enableRoomSocket(roomId);
|
||||
|
||||
const currentRoom = await roomQueries.findRoomById(roomId);
|
||||
|
|
|
@ -18,6 +18,7 @@ exports.up = function(knex) {
|
|||
table.float('komi').default(6.5);
|
||||
table.integer('handicap').default(0);
|
||||
table.integer('board_size').default(19);
|
||||
table.boolean('open').default(true);
|
||||
|
||||
table.string('application');
|
||||
table.string('application_version');
|
||||
|
|
|
@ -10,7 +10,14 @@ exports.seed = function(knex) {
|
|||
application: 'node-go', application_version: '0.1.0',
|
||||
player_black: 'anon', player_white: 'anon',
|
||||
player_black_rank: 'K3', player_white_rank: 'K2',
|
||||
room: 1, time_setting: 1
|
||||
room: 1, time_setting: 1, open: false
|
||||
},
|
||||
{
|
||||
id: 2, date: new Date(),
|
||||
application: 'node-go', application_version: '0.1.0',
|
||||
player_black: 'user-one', player_black_rank: 'UR',
|
||||
user_black: 2,
|
||||
room: 1, time_setting: 1, open: true
|
||||
}
|
||||
]);
|
||||
});
|
|
@ -9,7 +9,8 @@
|
|||
"migrate": "./node_modules/.bin/knex migrate:latest",
|
||||
"migrate-test": "./node_modules/.bin/knex migrate:latest --env test",
|
||||
"seed": "./node_modules/.bin/knex seed:run",
|
||||
"make-seed": "./node_modules/.bin/knex seed:make"
|
||||
"make-seed": "./node_modules/.bin/knex seed:make",
|
||||
"reset-db": "./node_modules/.bin/knex migrate:rollback true && npm run migrate && npm run seed"
|
||||
},
|
||||
"dependencies": {
|
||||
"bcrypt": "^3.0.7",
|
||||
|
|
Loading…
Reference in a new issue