TypeORM-readme-40.ts
· 295 B · TypeScript
Orginalformat
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from "typeorm"
import { PhotoMetadata } from "./PhotoMetadata"
import { Author } from "./Author"
@Entity()
export class Photo {
/* ... other columns */
@ManyToOne(() => Author, (author) => author.photos)
author: Author
}
1 | import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from "typeorm" |
2 | import { PhotoMetadata } from "./PhotoMetadata" |
3 | import { Author } from "./Author" |
4 | |
5 | @Entity() |
6 | export class Photo { |
7 | /* ... other columns */ |
8 | |
9 | @ManyToOne(() => Author, (author) => author.photos) |
10 | author: Author |
11 | } |