Corey Snyder
08/08/2019, 2:58 PMcontext.prisma.user({ id: args.user.id })
It appears that I can only do searches on certain fields, maybe ones marked as unique? Or maybe just IDs? If I try to run context.prisma.user({ email: '<mailto:corey@test.com|corey@test.com>' })
prisma throws errors that email isn’t on the list of properties which can be searched. This requires me to instead use context.prisma.users({ where: {email: '<mailto:corey@test.com|corey@test.com>' }})
which returns an array of items which I immediately have to get at the first item in the array like:
let user = (await context.prisma.users({
where: {
email: args.email.toLowerCase(),
}
}))[0] <<-- this part kinda sucks..
Am I doing this wrong? Is there a better way to go about it?Harshit
08/08/2019, 2:59 PMCorey Snyder
08/08/2019, 3:07 PMuser()
type User {
id: ID! @id
name: String!
email: String! @unique
Harshit
08/08/2019, 3:07 PMCorey Snyder
08/08/2019, 3:07 PM