import { Exclude } from "class-transformer";
import { Column, CreateDateColumn, Entity, ManyToOne, OneToMany, PrimaryGeneratedColumn } from "typeorm";

@Entity()
export class Comment {

    @PrimaryGeneratedColumn()
    id: number

    @Column()
    content: string

    @Column()
    userId: number

    @Column()
    userName: string

    @Column()
    momentsId: number

    @Column({ nullable: true })
    rootCommentId: number

    @Column({ nullable: true })
    toCommentId: number

    @Column({ default: 0 })
    commentLikeCount: number

    @Column()
    replyUserName: string

    @Column({ default: 0 })
    replyNum: number

    @Column({ default: false })
    isTop: boolean

    @Column({ default: false })
    isDel: boolean

    @CreateDateColumn()
    createdAt: Date

    @Exclude()
    childList?: Comment[]

    @Exclude()
    isLiked: boolean = false

}