I have a schema where I have a `User` model, a `Te...
# prisma-whats-new
w
I have a schema where I have a
User
model, a
Team
model, and there is a 1-to-1 relationship between the two. If I have the
userId
, can I update a
Team
immediately with that
userId
, or do I first have to use the
userId
to query for the
teamId
and then update the user's team with that
teamId
?
n
@wallslide currently that's not possible. You'll need to query the id first and then run the update 🙂
👍 1
Also note that the nested update mutation on the
User
model is deceptive in this context, as it doesn't allow you to update the team itself, but it will connect the user to a different team. See also: https://github.com/graphcool/feature-requests/issues/127
w
gotcha, thanks
👍 1
I'm trying to create a team with an updateUser query, but I'm getting an error:
Copy code
Error: GraphQL error: Variable '$team' cannot be non input type 'Team!'. (line 1, column 38):
mutation ($userId: ID!, $team: Team!) {
the query looks like
Copy code
mutation ($userId: ID!, $team: Team!){
    updateUser(id: $userId, team: $team) {
      team {
        teamName,
      }
    }
  }
n
Team
is not an input type. The specific input type for the nested mutation on
User
needs to be looked up in the playground docs
w
I see now, thanks
👍 1