Excluding fields from InputTypes
I am getting an error regarding mismatching where statements between the generated where clause and prismas where - The types of 'where.AND' are incompatible between these types.
I have a feeling it's do with the complexity of modeIs and relations tripping up TS. Does that sound about right?
Is there a way to completely exclude a field from Generating into the WhereInput?
Something like e.g.
model Organisation {
id BigInt @id @default(autoincrement())
createdAt DateTime? @default(now()) @map("created_at") @db.Timestamp(0)
updatedAt DateTime? @updatedAt @map("updated_at") @db.Timestamp(0)
name String @db.VarChar(255)
users User[]
@@map("organisations")
}
model User {
id BigInt @id @default(autoincrement())
name String? @db.VarChar(255)
email String @unique(map: "users_email_unique") @db.VarChar(255)
/// Ignore
password String @db.VarChar(60)
/// Ignore
organisationId BigInt? @map("organisation_id")
/// Ignore
organisation Organisation? @relation(fields: [organisationId], references: [id])
@@map("users")
}
Generates something like
@InputType()
export class UserWhereInput {
@Field(() => [UserWhereInput], {nullable:true})
AND?: Array<UserWhereInput>;
@Field(() => [UserWhereInput], {nullable:true})
OR?: Array<UserWhereInput>;
@Field(() => [UserWhereInput], {nullable:true})
NOT?: Array<UserWhereInput>;
@Field(() => BigIntFilter, {nullable:true})
id?: BigIntFilter;
@Field(() => StringFilter, {nullable:true})
name?: StringFilter;
@Field(() => StringFilter, {nullable:true})
email?: StringFilter;
}
``
You mean exclude completely from class, not from graphql schema? It's not possible. In this case prisma types and generated types by this generator will be not compatible, this generator is about graphql and you can exclude some fields from schema.
I would like to not allow providing the id field in inputs at all. Is it possible to remove the field entirely not just adding @HideInput?