node-go/packages/server/data/queries/room.js
2020-02-05 16:54:09 -08:00

25 lines
No EOL
432 B
JavaScript

const knex = require('../db');
const roomSelect = [
'id', 'name', 'description', 'language',
]
const findPublicRooms = async () => {
return await knex('room')
.where('private', false)
.select(roomSelect);
}
const findRoomById = async (roomId) => {
const results = await knex
.from('room')
.select(roomSelect)
.where('room.id', roomId)
return results[0]
}
module.exports = {
findPublicRooms,
findRoomById
}