node-go/server/data/queries/room.js

25 lines
432 B
JavaScript
Raw Permalink Normal View History

2020-01-21 07:05:55 +00:00
const knex = require('../db');
2020-01-18 23:49:35 +00:00
const roomSelect = [
'id', 'name', 'description', 'language',
]
2020-01-18 23:49:35 +00:00
const findPublicRooms = async () => {
return await knex('room')
.where('private', false)
.select(roomSelect);
2020-01-18 23:49:35 +00:00
}
const findRoomById = async (roomId) => {
const results = await knex
.from('room')
.select(roomSelect)
.where('room.id', roomId)
return results[0]
}
2020-01-18 23:49:35 +00:00
module.exports = {
findPublicRooms,
findRoomById
2020-01-18 23:49:35 +00:00
}