node-go/packages/server/data/queries/message.js

19 lines
374 B
JavaScript
Raw Normal View History

2020-01-21 07:36:52 +00:00
const knex = require('../db');
const joinUserSelect = [
'content', 'username', 'admin'
]
2020-01-21 07:36:52 +00:00
const findMessageByRoom = async (roomId) => {
return await knex
.from('message')
.where({'message.room': roomId})
.select(joinUserSelect)
.join('user', function() {
this.on('message.user', '=', 'user.id')
})
// .toSQL();
2020-01-21 07:36:52 +00:00
}
module.exports = {
findMessageByRoom
}