MichalLytek / MichalLytek/typegraphql-prisma

More granular omit options

Open
#238 3 comments 3 reactions 1 assignee Claimed by @MichalLytek View on GitHub
enhancement priority:medium
Dominant language
TypeScript
Stars
918
Forks
130
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

Take a model like:

```prisma
model Person {
id String @id @default(cuid())
email String
firstname String
surname String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
users User[]
}
```

This outputs all the fields in all the input types, meaning users can update the `createdAt` and `updatedAt` - which will be handled by Prisma.

If we use `/// @TypeGraphQL.omit(input: true)`, this omits the type from all inputs, including the `Where` inputs, so these fields cannot be used in where queries.

**Describe the solution you'd like**

It would be good to make the `omit` more granular, i.e. `/// @TypeGraphQL.omit(update: true)`, preventing the fields from being part of the `Update` inputs, but still allowing them to be part of the `Where` inputs.

**Describe alternatives you've considered**

Not sure if there are any, it's rather an all or nothing setting at the moment?

**Additional context**
Add any other context or screenshots about the feature request here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.