Skip to content

allow server to be passed to model - #2

Draft
miccoh1994 wants to merge 2 commits into
getapper:masterfrom
Design2Digital:allow-model-to-be-function
Draft

allow server to be passed to model#2
miccoh1994 wants to merge 2 commits into
getapper:masterfrom
Design2Digital:allow-model-to-be-function

Conversation

@miccoh1994

Copy link
Copy Markdown

Upgraded deps... and allow a user to pass anything to a function that returns their model.

example:

module.exports = (server) => {
    return {
        ...
        getUser: async (username, password) => {
             const { Users } = server.models();
             const user = await Users.query().select(*).where({username});
             const valid = compare(password, user.password);
             if (valid) return user;
        }
        ...
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants