David
07/05/2021, 3:13 PMprisma.query.create as follows (where queryService(data) is just calling prisma.create({data}) ):
const query = await this.queryService.createQuery({
genome: s.slice(0,10),
type: 'Auto',
description: form.description,
user: {
connect: {id: user.id}
}
});
This produces the error pretty much no matter what I do. I logged the object I'm trying to insert, seems fine... so I don't see what the problem is. The relevant model is:
model Query {
id String @id @default(uuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
user User @relation(fields: [userId], references: [id])
userId String
genome String
type GenomeType @default(Auto)
description String?
result String?
}
Would appreciate any help!Giorgio Delgado
07/05/2021, 4:43 PM> character in the genome field?David
07/05/2021, 4:47 PMgenome: '' earlier, and just did it again, no change.
{
genome: '',
type: GenomeType.Auto,
description: form.description,
user: {
connect: {id: user.id}
}
}janpio
janpio
janpio
David
07/05/2021, 4:59 PMDavid
07/05/2021, 5:24 PMInvalid `prisma.blastQuery.create()` invocation:
An operation failed because it depends on one or more records that were required but not found. No 'User' record(s) (needed to inline the relation on 'BlastQuery' record(s)) was found for a nested connect on one-to-many relation 'BlastQueryToUser'. +13253ms
Then I realized I accidentally did const user = session instead of const {user} = session, so I was looking up session uuid and not user uuid... what a classic screw up lol. I love coding, it's like you have all these complex problems and you troubleshoot in complex ways and then you find out you just forgot to destructure 😂David
07/05/2021, 5:24 PMquery {} in GQL. If this name conflict does exist, that's probably worth documenting somewhere, if even only in a troubleshooting section.janpio
janpio
Query thing? Maybe even with a smaller reproduction?
As soon as you read about our internal GraphQL API you know something is really broken 😞David
07/05/2021, 5:36 PMgetSessionData(id: string): Promise<Session | null> {
const includeUsers = Prisma.validator<Prisma.SessionInclude>()({
user: true
});
return this.prisma.session.findFirst({
where: {id},
include: includeUsers
});
}
Here, Promise<Session | null> is a lie, since it's actually Session & {user: User}...janpio
janpio
I'm pretty new to Prisma so haven't meddled much with internals.You should not even know that there is some GraphQL like thing under the hood 😄
David
07/05/2021, 6:39 PMDavid
07/08/2021, 3:57 AMjanpio