Totoro
07/29/2019, 10:43 PMtype User {
id: ID! @id
firstName: String!
lastName: String @default(value: "")
email: String! @unique
passwordHash: String
emailVerified: Boolean! @default(value: false)
verifyToken: String
avatar: String
userSource: UserSource!
identities: [Identity!]
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Identity {
id: ID! @id
service: ServiceType!
serviceId: String!
username: String!
email: String!
name: String
accessToken: String! @db(name: "access_token")
tokenType: String! @db(name: "token_type")
expiresAt: DateTime @db(name: "expires_at")
refreshToken: String! @db(name: "refresh_token")
idToken: String @db(name: "id_token")
user: User! @relation(link: INLINE)
}
I'm trying to list identities and get the email from array of identities like this:
const id = await prisma
.user({ id: user.id })
.identities({
where: {
service: USER_SOURCE.GOOGLE,
},
});
console.log(id.email);
When I console.log(id)
, I can see all the values but console.log(id.email);
shows nothing to meHarshit
07/30/2019, 6:31 PMid[0].email
if you want to access the first element or map over the array to get an array of emails