'How to filtering mutation with boolean if isVerified === true user can signin
Hello how can i filtering and find only isverified === true user can signin? And if it false user can't signin in mutation.
My code on mutation
signin: async (
_: any,
{ credentials }: SignInArgs,
{ db }: Context
): Promise<UserPayloadType> => {
const { email, password } = credentials;
// compare input form email with data in database avaliable or not
const user = await db.user.findUnique({
where: {
email,
},
});
if (!user) {
return {
userErrors: [
{
message: "There was a problem with your login",
},
],
token: null,
};
}
mutation : activationAccount(emailAccount: String): ActivationAccountPayload!
query:
type User {
id: ID!
username: String!
name: String!
isVerified: Boolean!
#this is will updating on db in every signup
email: String
image: String
# likes: [LikedPost]!
posts(take: Int!, skip: Int!): [Post!]!
profession: [Profession!]!
}
any help i appreciate it. Please help me :")🙏
Solution 1:[1]
This is a litle problem hehe, yesterday was not focusing what i do.
So in user.findmany that you find the user and then
just call user.isverified === boolean and adding a if statement and it working fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rizukyyy |
