25 lines
No EOL
432 B
JavaScript
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
|
|
} |