Hi.
How could I write a custom mutation resolver, for a "Login", comparing a password with bcrypt with the query password.
I have seen several ways but I would like to know which is the best.
Some in the resolver put the cypher query and in others the cypher query put it in the mutation schema.
Login: async (object, { email, password }, context, resolveInfo) => {
const user = await neo4jgraphql(
object,
{ email, password },
context,
resolveInfo
);
} ....
Login(email: String!, password: String!): String
@cypher(
statement: "MATCH (u:User { email: $email, password: $password }) WITH { email: u.email, userId: u.userId, password: u.password } as LoginInfo RETURN LoginInfo"
)
or
Login: async (_, { email, password }, { driver, req, user }) => {
const session = driver.session() ......
}
Login(email: String!, password: String!): String!