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

19 lines
No EOL
374 B
JavaScript

const knex = require('../db');
const joinUserSelect = [
'content', 'username', 'admin'
]
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();
}
module.exports = {
findMessageByRoom
}