nestjs-paginate/src/__tests__/cat.entity.ts

29 lines
674 B
TypeScript
Raw Normal View History

import { Column, CreateDateColumn, Entity, JoinColumn, OneToMany, OneToOne, PrimaryGeneratedColumn } from 'typeorm'
import { CatToyEntity } from './cat-toy.entity'
import { CatHomeEntity } from './cat-home.entity'
@Entity()
export class CatEntity {
@PrimaryGeneratedColumn()
id: number
@Column()
name: string
@Column()
color: string
@Column({ nullable: true })
age: number | null
@OneToMany(() => CatToyEntity, (catToy) => catToy.cat)
toys: CatToyEntity[]
@OneToOne(() => CatHomeEntity, (catHome) => catHome.cat, { nullable: true })
@JoinColumn()
home: CatHomeEntity
@CreateDateColumn()
createdAt: string
}