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