MichalLytek / MichalLytek/typegraphql-prisma

ability to omit compound unique from typegraphql types

Open
#431 5 comments 0 reactions 0 assignees View on GitHub
community enhancement priority:low
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.**
assume you have this model:

```
model MyModel {
id String
organizationId String

@@unique([id, organizationId])
}
```

there doesn't seem to be a way to hide the generated `id_organizationId` field in typegraphql-generated types (if there is please let me know) :)

**Describe the solution you'd like**
The clearest way I can think of is to make `/// @TypeGraphQL.omit(input: true)` work for `@@unique`

**Describe alternatives you've considered**
???

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how Prisma @@unique constraints produce the generated id_organizationId field in TypeGraphQL types. Compare how @TypeGraphQL.omit(input: true) is applied to other generated fields, then verify that the compound-unique field is omitted from generated input types when requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.