Missed import class for self one to one relation with separateRelationFields
Antoxa1081 opened this issue · 0 comments
Antoxa1081 commented
Expected Behavior
comment_relations.ts
import { Post } from './post';
import { User } from './user';
import { Tag } from './tag';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Comment } from './comment';
export class CommentRelations {
@ApiProperty({ type: () => Post })
post: Post;
@ApiProperty({ type: () => User })
user: User;
@ApiPropertyOptional({ type: () => Comment })
replyTo?: Comment;
@ApiProperty({ isArray: true, type: () => Comment })
replyComments: Comment[];
@ApiProperty({ isArray: true, type: () => Tag })
tags: Tag[];
@ApiProperty({ isArray: true, type: () => User })
likedUsers: User[];
@ApiProperty({ isArray: true, type: () => User })
mentionedUsers: User[];
}
Actual Behavior
comment_relations.ts
import { Post } from './post';
import { User } from './user';
import { Tag } from './tag';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class CommentRelations {
@ApiProperty({ type: () => Post })
post: Post;
@ApiProperty({ type: () => User })
user: User;
@ApiPropertyOptional({ type: () => Comment })
replyTo?: Comment;
@ApiProperty({ isArray: true, type: () => Comment })
replyComments: Comment[];
@ApiProperty({ isArray: true, type: () => Tag })
tags: Tag[];
@ApiProperty({ isArray: true, type: () => User })
likedUsers: User[];
@ApiProperty({ isArray: true, type: () => User })
mentionedUsers: User[];
}
Steps to Reproduce the Problem
generator prismaClassGenerator {
provider = "prisma-class-generator"
output = "../src/prisma/prisma-class"
dryRun = false
separateRelationFields = true
}
model Comment {
id Int @id @default(autoincrement())
postId Int
post Post @relation(fields: [postId], references: [id])
userId Int
user User @relation(fields: [userId], references: [id])
replyToId Int?
replyTo Comment? @relation(fields: [replyToId], references: [id], name: "_ReplyComments")
replyComments Comment[] @relation(name: "_ReplyComments")
message String
tags Tag[]
likedUsers User[] @relation(name: "_CommentsLikedUsers")
mentionedUsers User[] @relation(name: "_CommentsMentionedUsers")
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
}
Missed import class Comment in comment_relations.ts
file for self one to one relation with separateRelationFields param
Specifications
- Version: 0.2.6
- Prisma Version: 4.15.0
- Platform: windows