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

45 lines
882 B
TypeScript
Raw Normal View History

import {
Column,
CreateDateColumn,
DeleteDateColumn,
Entity,
JoinColumn,
OneToMany,
OneToOne,
PrimaryGeneratedColumn,
} from 'typeorm'
import { CatToyEntity } from './cat-toy.entity'
import { CatHomeEntity } from './cat-home.entity'
2022-10-28 11:50:58 +00:00
import { SizeEmbed } from './size.embed'
@Entity()
export class CatEntity {
@PrimaryGeneratedColumn()
id: number
@Column()
name: string
@Column()
color: string
@Column({ nullable: true })
age: number | null
2022-10-28 11:50:58 +00:00
@Column(() => SizeEmbed)
size: SizeEmbed
@OneToMany(() => CatToyEntity, (catToy) => catToy.cat)
toys: CatToyEntity[]
@OneToOne(() => CatHomeEntity, (catHome) => catHome.cat, { nullable: true })
@JoinColumn()
home: CatHomeEntity
@CreateDateColumn()
createdAt: string
@DeleteDateColumn({ nullable: true })
deletedAt?: string
}