seepur/app/Utils/CallUtils.js

18 lines
445 B
JavaScript

const Book = use('App/Models/Book');
class CallUtils {
static async getBooks(parent_id, guest_id) {
const result = await Book.query()
.where({user_id: parent_id})
.orWhere({user_id: guest_id})
.orWhere({user_id: null})
.fetch();
if (!result.rows.length)
return [];
else
return result.rows;
}
}
module.exports = CallUtils;