const Schmervice = require('@hapipal/schmervice') /** Class for methods used in the User plugin */ module.exports = class UserService extends Schmervice.Service { /** * Unsure of what our constructor does * @param {...any} args */ constructor(...args) { super(...args) } /** * Use to find first user with useremail * @param {String} email * @param {*} txn * @returns {User} */ async findByEmail(email, txn) { const { User } = this.server.models() const user = await User.query(txn) .throwIfNotFound() .first() .where({ user_email: email }) return user } }