Git Product home page Git Product logo

Comments (5)

MichalLytek avatar MichalLytek commented on June 11, 2024

You need this field in inputs in order to properly find unique records in db via graphql api.

from typegraphql-prisma.

shawnjones253 avatar shawnjones253 commented on June 11, 2024

You need this field in inputs in order to properly find unique records in db via graphql api.

sorry, my example should have marked the id as @unique as well

in my case, i want to expose id as the only unique the caller is allowed to use for input, despite prisma allowing id | id_organizationId

from typegraphql-prisma.

shawnjones253 avatar shawnjones253 commented on June 11, 2024

to make this more clear, i can hide regular @uniques but not @@uniques -- as long as i leave at least one of the regular @uniques available to the caller that should still work with findUnique right?

from typegraphql-prisma.

shawnjones253 avatar shawnjones253 commented on June 11, 2024

@MichalLytek -- here's a clearer example:

model MyModel {
  id String @unique
  /// @TypeGraphQL.omit(output: true, input: true)
  organizationId String

  @@unique([id, organizationId])
}

this currently generates:

export declare class MyModelWhereUniqueInput {
    id?: string | undefined;
    id_organizationId?: MyModelIdOrganizationIdCompoundUniqueInput | undefined;
}

but what i want to generate instead is:

export declare class MyModelWhereUniqueInput {
    id?: string | undefined;
}

that still has at least one unique field (id) so it would still be usable as input to findUnique

for context, organizationId should be opaque to end users in my application, i'd like to use it in a prisma context without exposing it via the api / typegraphql types

from typegraphql-prisma.

shawnjones253 avatar shawnjones253 commented on June 11, 2024

@MichalLytek see clarification above

from typegraphql-prisma.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.