Neo Lambada
07/27/2021, 7:55 PMFaiyam Rahman
07/27/2021, 8:55 PMDavid
07/27/2021, 9:11 PMnikunj chaudhari
07/28/2021, 1:48 AMjson
file
How do i send mutation?Gelo
07/28/2021, 2:56 AMgershon bialer
07/28/2021, 5:15 AMFaizan
07/28/2021, 6:59 AMmodel Campaign {
id String @id @default(uuid())
company Company @relation(fields: [companyId], references: [id])
companyId String
}
model Company {
id String @id @default(uuid())
Campaign Campaign[]
}
------------------
await prisma.campaign.updateMany({
where: { id: campaignId, companyId },
data: { ...data }
});
I have to query campaign by it's ID but I also use company ID(which is authenticated) to match and verify that the campaign belongs to the authorized company rather than just updating it.
But I have to use updateMany
instead of update
because update does not support more than one argument in the where.
I need to the updated object as the return value which is available in update
which I can not use due to the above limitation. Is there a workaround for this? Thanks.Bodhi Vandael
07/28/2021, 9:50 AMBodhi Vandael
07/28/2021, 9:50 AMGelo
07/28/2021, 10:20 AMMatt Pocock
07/28/2021, 11:32 AMMatt Pocock
07/28/2021, 11:32 AMnikunj chaudhari
07/28/2021, 1:08 PMPatrick
07/28/2021, 1:59 PMawait clock.tickAsync(10000)
I need to mock time to test for cases like correct token expirations etc. Is there something like a timeout in prisma or anything that could cause this error?
StackTrace:
TypeError: Cannot read property 'paused' of undefined
at onBodyTimeout (/home/patrick/Code/xxx/server/node_modules/@prisma/client/runtime/index.js:24829:16)
at callTimer (/home/patrick/Code/xxx/server/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:423:24)
at doTickInner (/home/patrick/Code/xxx/server/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:894:29)
at Immediate.nextPromiseTick (/home/patrick/Code/xxx/server/node_modules/@sinonjs/fake-timers/src/fake-timers-src.js:955:25)
at processImmediate (internal/timers.js:461:21)
at process.topLevelDomainCallback (domain.js:144:15)
at process.callbackTrampoline (internal/async_hooks.js:129:14)
Taylor Preston
07/28/2021, 6:01 PMCarlos Gomez
07/28/2021, 9:56 PMKent C. Dodds
07/28/2021, 10:32 PMconst result = await prisma.postRead.groupBy({
by: ['postSlug'],
orderBy: { postSlug: 'asc', },
_count: true,
take: limit,
})
EDIT AGAIN: I think this won't work with a limit because we're not ordering by the count, but by the postSlug. Anyone know if it's possible to order by the slug? Otherwise I have to get all the data and then limit it.Reid Ashwill
07/28/2021, 11:50 PMpropagandalf
07/29/2021, 12:09 AMAND
& OR
on the [Type]WhereInput
doesn't exist for findUnique() - but it does for findFirst()?
I'm sitting with a specific usecase where I'd like to avoid using findFirst, because findUnique is perfect for the use case.
It really doesn't matter, just curious as to why exactly it isn't universally added.Gelo
07/29/2021, 3:16 AMGelo
07/29/2021, 11:12 AMMarc
07/29/2021, 11:35 AMrelationOnDelete
is already available in the DMMF types, but I am missing the field relationOnUpdate
.
Additionally, I noticed that the default values for relationOnDelete
(SetNull
and Restrict
) are missing in the generator step, if not explicitly added to the schema. I wrote this into this issue. Should I create an issue in the prisma repo as well?Vladi Stevanovic
Vladi Stevanovic
khareta
07/29/2021, 1:24 PM[GraphQL error]: Message: Unknown object type "promise"
https://github.com/MichalLytek/type-graphql/discussions/964Ahmar Suhail
07/29/2021, 1:26 PMDaniel Olavio Ferreira
07/29/2021, 1:49 PMAnkit Singh
07/29/2021, 2:14 PMtraineeUser
is also coming with the data but i want to include its content.
Idk if i am missing anything here!?Anders
07/29/2021, 2:55 PM