Dernière activité 1729146212

TypeORM-readme-39.ts Brut
1import {
2 Entity,
3 Column,
4 PrimaryGeneratedColumn,
5 OneToMany,
6 JoinColumn,
7} from "typeorm"
8import { Photo } from "./Photo"
9
10@Entity()
11export class Author {
12 @PrimaryGeneratedColumn()
13 id: number
14
15 @Column()
16 name: string
17
18 @OneToMany(() => Photo, (photo) => photo.author) // note: we will create author property in the Photo class below
19 photos: Photo[]
20}