You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following prisma schema
`model Contract {
id Int @id@default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
items Item[]
}
model Item {
id Int @id@default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
contract Contract @relation(fields: [contractId], references: [id])
contractId Int
}`
I would like to create a mutation to edit a contract along with its Items so that the user can edit multiple item names in a contract at once.
I am getting stuck on the typing.
here is what I have so far in the builder
`builder.prismaObject("Contract", {
fields: (t) => ({
id: t.exposeID("id"),
name: t.exposeString("name"),
items: t.relation("items"),
}),
});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have the following prisma schema
`model Contract {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
items Item[]
}
model Item {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
contract Contract @relation(fields: [contractId], references: [id])
contractId Int
}`
I would like to create a mutation to edit a contract along with its Items so that the user can edit multiple item names in a contract at once.
I am getting stuck on the typing.
here is what I have so far in the builder
`builder.prismaObject("Contract", {
fields: (t) => ({
id: t.exposeID("id"),
name: t.exposeString("name"),
items: t.relation("items"),
}),
});
builder.inputType('ItemInput', {
fields: (t) => ({
name: t.string(),
contractId: t.int(),
}),
});
`
The mutation would take contractId, and a list of ItemInput( contractId and name)
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions