TypeORM-readme-33.ts
· 323 B · TypeScript
Orginalformat
import {
Entity,
Column,
PrimaryGeneratedColumn,
OneToOne,
JoinColumn,
Relation,
} from "typeorm"
import { Photo } from "./Photo"
@Entity()
export class PhotoMetadata {
/* ... other columns */
@OneToOne(() => Photo, (photo) => photo.metadata)
@JoinColumn()
photo: Relation<Photo>
}
1 | import { |
2 | Entity, |
3 | Column, |
4 | PrimaryGeneratedColumn, |
5 | OneToOne, |
6 | JoinColumn, |
7 | Relation, |
8 | } from "typeorm" |
9 | import { Photo } from "./Photo" |
10 | |
11 | @Entity() |
12 | export class PhotoMetadata { |
13 | /* ... other columns */ |
14 | |
15 | @OneToOne(() => Photo, (photo) => photo.metadata) |
16 | @JoinColumn() |
17 | photo: Relation<Photo> |
18 | } |