TypeORM-readme-43.sh
· 311 B · Bash
Raw
import {
Entity,
PrimaryGeneratedColumn,
Column,
ManyToMany,
JoinTable,
} from "typeorm"
@Entity()
export class Album {
@PrimaryGeneratedColumn()
id: number
@Column()
name: string
@ManyToMany(() => Photo, (photo) => photo.albums)
@JoinTable()
photos: Photo[]
}
1 | import { |
2 | Entity, |
3 | PrimaryGeneratedColumn, |
4 | Column, |
5 | ManyToMany, |
6 | JoinTable, |
7 | } from "typeorm" |
8 | |
9 | @Entity() |
10 | export class Album { |
11 | @PrimaryGeneratedColumn() |
12 | id: number |
13 | |
14 | @Column() |
15 | name: string |
16 | |
17 | @ManyToMany(() => Photo, (photo) => photo.albums) |
18 | @JoinTable() |
19 | photos: Photo[] |
20 | } |