

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;
