P
Prisma4mo ago
Dbugger

I can't disconnect a many-to-many relationship

Disconnecting the previous contact relationships is giving me a lot of headache. What's wrong with this statement?
→ 16 update: ({ where, data }) => prismaModel.update({
where: {
id: "80d02590-489c-4a76-80c8-dafb86c94f3f",
organizationId: "803f8966-f808-4da6-96cf-354d355f0f85"
},
data: {
number: "0JD-05242",
dateIssued: new Date("2024-06-07T00:00:00.000Z"),
dueDate: new Date("2024-06-21T00:00:00.000Z"),
sender: "Berge, Lehner and Grimes\r\n350 Marilie Inlet\r\nLake Jovanichester, New Jersey 92127-2846\r\nBelize",
recipient: "Murphy LLC\r\n9176 Mante Fall\r\nLongview, Mississippi, 65850-0376\r\nRussian Federation",
items: [
{
taxRate: 0,
quantity: 1,
unitPrice: 0,
description: ""
}
],
status: "Draft",
footnotes: "",
purchaseOrder: "",
contacts: {
disconnect: {
contactId: {
notIn: [
"ab819c7a-3125-489a-8226-aa4374a2e7fd"
]
}
},
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
create: [
{
contact: {
connect: {
id: "ab819c7a-3125-489a-8226-aa4374a2e7fd"
}
}
}
]
},
attachments: {
create: [],
deleteMany: {
id: {
in: []
}
}
}
}
})

Argument `disconnect`: Invalid value provided. Expected InvoiceContactWhereUniqueInput[], provided Object.
→ 16 update: ({ where, data }) => prismaModel.update({
where: {
id: "80d02590-489c-4a76-80c8-dafb86c94f3f",
organizationId: "803f8966-f808-4da6-96cf-354d355f0f85"
},
data: {
number: "0JD-05242",
dateIssued: new Date("2024-06-07T00:00:00.000Z"),
dueDate: new Date("2024-06-21T00:00:00.000Z"),
sender: "Berge, Lehner and Grimes\r\n350 Marilie Inlet\r\nLake Jovanichester, New Jersey 92127-2846\r\nBelize",
recipient: "Murphy LLC\r\n9176 Mante Fall\r\nLongview, Mississippi, 65850-0376\r\nRussian Federation",
items: [
{
taxRate: 0,
quantity: 1,
unitPrice: 0,
description: ""
}
],
status: "Draft",
footnotes: "",
purchaseOrder: "",
contacts: {
disconnect: {
contactId: {
notIn: [
"ab819c7a-3125-489a-8226-aa4374a2e7fd"
]
}
},
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
create: [
{
contact: {
connect: {
id: "ab819c7a-3125-489a-8226-aa4374a2e7fd"
}
}
}
]
},
attachments: {
create: [],
deleteMany: {
id: {
in: []
}
}
}
}
})

Argument `disconnect`: Invalid value provided. Expected InvoiceContactWhereUniqueInput[], provided Object.
1 Reply
Dbugger
Dbugger4mo ago
This is the model, by the way:
model InvoiceContact {
// Relations
invoice Invoice @relation(fields: [invoiceId], references: [id], onDelete: Cascade, onUpdate: Cascade)
invoiceId String

contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade, onUpdate: Cascade)
contactId String

@@id([invoiceId, contactId])
}
model InvoiceContact {
// Relations
invoice Invoice @relation(fields: [invoiceId], references: [id], onDelete: Cascade, onUpdate: Cascade)
invoiceId String

contact Contact @relation(fields: [contactId], references: [id], onDelete: Cascade, onUpdate: Cascade)
contactId String

@@id([invoiceId, contactId])
}
Want results from more Discord servers?
Add your server