prisma-class-validator-generator
prisma-class-validator-generator copied to clipboard
Provide option to separate between relations and fields
Discussed in https://github.com/omar-dulaimi/prisma-class-validator-generator/discussions/3
Originally posted by ErlanggaDewa July 13, 2022 There is an option to seperate between the relationship and the field??
I want to seperate StudentProfile relationship from the model (ApproveRequest.model.ts) to become ApproveRequest.model.ts and ApproveRequestRelationship.model.ts. Because your program still make the relationship field into one files
Example prisma schema case 👇
model ApproveRequest {
id String @id @unique @default(uuid()) @map("id")
identifyNumber String @map("identify_number") @db.VarChar(100)
requestDate String @map("request_date") @db.VarChar(50)
StudentProfile StudentProfile? @relation(fields: [identifyNumber], references: [identifyNumber])
}
My expected 2 files output 👇
ApproveRequest.model.ts
export class ApproveRequest {
@IsDefined()
@IsString()
id!: string;
@IsDefined()
@IsString()
identifyNumber!: string;
}
and
ApproveRequestRelationship.model.ts
export class ApproveRequestRelationship {
@IsOptional()
StudentProfile?: StudentProfile;
}
it's help me, or you can make some option like :
- seperate relation
- relation and and other field become 1 files (like your program now)
- not generating relation field
Originally posted by @ErlanggaDewa in https://github.com/omar-dulaimi/prisma-class-validator-generator/discussions/3#discussioncomment-3165615
Hello @erlanggadewa
Do you still need this?
@omar-dulaimi yes, i still need this. thanks for remind me