Melvin Gaye
07/22/2021, 11:21 PMEdward Baer
07/22/2021, 11:22 PMJ Giri
07/23/2021, 3:49 AMtypegraphql-prisma
issue which i face most often.
The feature of "hiding prisma model field in graphql schema" doesnt work most of the time. Presently also its not working
As per doc I implemented /// @TypeGraphQl.omit(output: true
to hide the password field in graphql Schema.
model User {
id String @id @default(cuid()) @map("_id")
firstName String @map("first_name")
lastName String @map("last_name")
email String @unique
/// @TypeGraphQl.omit(output: true)
password String
@@map("user")
}
IN GENERATED TYPES, EXPECTED RESULT SHOULD BE
@TypeGraphQL.ObjectType({
isAbstract: true
})
export class User {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
id!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
firstName!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
lastName!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
email!: string;
password?: string;
}
BUT WHAT I GET IN GENERATED TYPES IS
@TypeGraphQL.ObjectType({
isAbstract: true
})
export class User {
@TypeGraphQL.Field(_type => String, {
nullable: false
})
id!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
firstName!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
lastName!: string;
@TypeGraphQL.Field(_type => String, {
nullable: false
})
email!: string;
/** @TypeGraphQl.omit(output: true) */
@TypeGraphQL.Field(_type => String, {
nullable: false,
description: "@TypeGraphQl.omit(output: true)"
})
password!: string;
}
What I get in my unexpected result is not hiding graphql schema field. What am i getting unexpected result?
In the past very few times i got expected generated types. Most often if emits the unexpected output, which is mentioned above, in generated typesRoy Segall
07/23/2021, 7:23 AMfindMany
we can do include
but how can I do it in groupBy
?Halvor
07/23/2021, 11:13 AMuser
07/23/2021, 11:42 AMpsql
command.
Download the Postgres Mac App: https://postgresapp.com/
Setting up a local PostgreSQL Database guide: https://www.prisma.io/dataguide/postgresql/setting-up-a-local-postgresql-database
Prisma's Data Guides for PostgreSQL: https://www.prisma.io/dataguide/postgresql
Make interfacing with your data super simple with Prisma's PostgreSQL connector: https://www.prisma.io/docs/concepts/database-connectors/postgresql
Learn more about Prisma:
◭ Website: https://www.prisma.io
◭ Docs: https://www.prisma.io/docs
◭ Quickstart: https://www.prisma.io/docs/getting-started/quickstart-typescriptHalvor
07/23/2021, 1:47 PMHalvor
07/23/2021, 1:47 PMprisma.stat.count({
where: {
arbitrated: {
where: {
session_id: arbitratedSessionId
}
}
}
Halvor
07/23/2021, 1:48 PMHalvor
07/23/2021, 1:49 PMMelvin Gaye
07/23/2021, 2:26 PMNaotho Machida
07/23/2021, 3:30 PMJan Georg
07/23/2021, 6:59 PMmodel Item {
id String @id
name String
parentId String?
parent Item? @relation("ItemHierarchy", fields: [parentId], references: [id])
predecessor Item? @relation("ItemHierarchy")
}
// seed.js
await prisma.item.upsert({ id: "1", name: "1" }
await prisma.item.upsert({ id: "2", name: "2", { parent: { connect: { id: "1" } } } }
await prisma.item.upsert({ id: "3", name: "3", { parent: { connect: { id: "1" } } } }
...
await prisma.item.upsert({ id: "10", name: "10", { parent: { connect: { id: "1" } } } }
Harun
07/24/2021, 9:20 AMIvan
07/24/2021, 9:27 AMLuis Cardoso
07/24/2021, 4:40 PMUnique constraint failed on the fields: (`id`)
this is my service:
async createTask(
createTaskDto: Prisma.TaskCreateInput,
user: User,
): Promise<Task> {
return this.prismaService.task.create({
data: {
...createTaskDto,
user: {
create: user,
},
},
});
}
and here is my db schema:
model Task {
id String @id @default(uuid())
title String @db.VarChar(20)
description String @db.VarChar(200)
status TaskStatus @default(OPEN)
user User @relation(fields: [userId], references: [id])
userId String
}
model User {
id String @id @default(uuid())
email String @unique
name String?
password String
tasks Task[]
}
I’m don’t know what is wrong, maybe I’m not getting how the relations work in Prisma. Can someone help me?arun
07/24/2021, 4:45 PMMichał K
07/24/2021, 7:16 PMprisma-examples
repo but getting the perm error. Is there a way to do that (I feel like i am missing sth 🙈 )Halvor
07/25/2021, 1:02 PMwhere: {
username: username
}
Shubham Patil
07/26/2021, 12:27 AMHalvor
07/26/2021, 1:13 AMHalvor
07/26/2021, 1:13 AMalisalimli
07/26/2021, 2:49 AMNaotho Machida
07/26/2021, 3:21 AMSofiane Akermoun
07/26/2021, 3:25 AMJemin Kothari
07/26/2021, 10:13 AMpreviewFeatures = ["orderByRelation"]
to support sorting with the relation model.
And it is working fine with prisma client. But in my project I used nexus and pal js with prisma and created graphql endpoint.
So how can I implement orderByRelation
with nexus graphql. Is there any docs?Angelo
07/26/2021, 10:31 AMcached plan must not change result typeAfter some googling I came up with a stackoverflow answer with people that managed to avoid that problem by doing this in the java driver
You can avoid the problem by configuring yourSo I was trying to see if Prisma had an option like that anywhere but couldn’t find any reference to it, does someone know what the problem is or if there is such a setting that I can set in Prisma?driver withpgjdbc
.autosave=conservative
Halvor
07/26/2021, 11:40 AMprisma.arbitrated.count({
where: {
id: 100
}
}) > 0;
khareta
07/26/2021, 12:52 PMis
isn't there, so I add it, then it starts complaining that is
is an unknown arg, did you mean id? so I remove is. What's going on here?
calling prisma.model.count()Henri Kuper
07/26/2021, 1:07 PM