Hi! I have `List` which has one more `Card` s (ima...
# orm-help
m
Hi! I have
List
which has one more
Card
s (imagine Trello). If for a particular card I want to change ownership (make it owned by another list), how I can do that?
Copy code
export const updateCard = async ({ cardId, data }, context) => {
  return context.entities.Card.update({
    where: { id: cardId },
    data: {
      // What should I write below? A failed attempt:
      list: { connect: { id: data.listId } }
    }
  })
}
r
What's the error you're getting on performing this?
m
I get:
Copy code
Unknown arg `list` in data.list for type CardUncheckedUpdateInput
I am actually dealing with 
Card
 and 
List
  entities -> List can contain one or more cards (imagine Trello)
Using @prisma/client@2.22.1
updated the code above to Card and List to make it easier to follow
Copy code
entity List {=psl
    id          Int     @id @default(autoincrement())
    name        String
    pos         Float

    // List has a single author.
    user        User    @relation(fields: [userId], references: [id])
    userId      Int

    cards       Card[]
psl=}

entity Card {=psl
    id          Int     @id @default(autoincrement())
    title       String
    pos         Float

    // Card belongs to a single list.
    list        List    @relation(fields: [listId], references: [id])
    listId      Int

    // Card has a single author.
    author      User    @relation(fields: [authorId], references: [id])
    authorId    Int
psl=}
These are the models (ignore {= psl =} tags)
r
Are you passing any other things in
data
for update apart from
list
?
m
no, only list
r
I’m not getting the above error when trying to reproduce, could you run
prisma generate
and check again?
m
tried everything from scratch but still the same hm
so this should work in theory?
r
Yes I just tried this on a clean database with sample data and it works fine.
If you could setup a small reproduction then I can have a look at it.
m
solved it - turns out that id was passed as a string instead of Int. But the error message wasn’t informative unfortunately
💯 1
r
Ohh, let me check if we have an issue regarding this.