Yasir Hussain
05/06/2020, 12:40 AMtype Student {
id: ID! @id
createdAt: DateTime! @createdAt
name: String!
email: String! @unique
password: String!
phone: String
photo: ImageFile @relation(name: "PhotoToFile")
coverPhoto: ImageFile @relation(name: "CoverPhotoToFile")
bio: String
dob: DateOfBirth
gender: Gender! @default(value:OTHER)
role: Role! @default(value:STUDENT)
address: String
classRoooms: [ClassRoom!]
socialLinks:[SocialLink!]}
type ImageFile {
id: ID! @id
assetId: String!
publicId: String!
url: String!
secureUrl: String!
}
and my type resolver:
const Student = {
async photo(parent, args, { prisma }, info) {
return prisma.query.student({ where: { id: parent.id } }).photo();
},
};
module.exports = Student;
Error:Charles Ponti
05/06/2020, 1:56 AMCharles Ponti
05/06/2020, 1:57 AMYasir Hussain
05/06/2020, 3:39 PMYasir Hussain
05/06/2020, 3:39 PMphoto: ImageFile @relation(name: "PhotoToFile")
this is a one way relationshipSachin Jani
05/07/2020, 10:44 AMprisma.student({id: parent.id }).photo();
and not prisma.query