Jo Sprague
03/02/2019, 11:05 PMtype CheckIn {
id: ID! @unique
location: Location!
user: User!
}
type User {
id: ID! @unique
checkIns: [CheckIn!]
}
type Location {
id: ID! @unique
checkIns: [CheckIn!]
}
How can I add @relation
directives to finish the relationship? Each CheckIn
has a user and a location, and each User
and Location
has a list of `CheckIn`s that refer to it.Jo Sprague
03/02/2019, 11:22 PMLocation
entries, but I want to pass in location data when I create a new CheckIn
. What's the right way to do that?
This is how I'm creating the CheckIn
, but I don't know what to pass in for `location`;
async createCheckIn(parent, { title, location }, context) {
const userId = getUserId(context);
return context.prisma.createCheckIn({
title,
location,
public: true,
user: { connect: { id: userId } }
});
}