mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
30 lines
671 B
TypeScript
30 lines
671 B
TypeScript
import {
|
|
Entity,
|
|
PrimaryGeneratedColumn,
|
|
Column,
|
|
ManyToMany,
|
|
JoinTable,
|
|
OneToMany,
|
|
} from "typeorm";
|
|
import { SpotifyLibraryDetails } from "src/sources/spotify/spotify-library-details.entity";
|
|
import { Artist } from "./artist.entity";
|
|
import { Track } from "./track.entity";
|
|
|
|
@Entity()
|
|
export class Album {
|
|
@PrimaryGeneratedColumn("uuid")
|
|
id: string;
|
|
|
|
@Column()
|
|
name: string;
|
|
|
|
@ManyToMany((type) => Artist, (artist) => artist.albums)
|
|
@JoinTable({ name: "album_artists" })
|
|
artists: Artist[];
|
|
|
|
@OneToMany((type) => Track, (track) => track.album)
|
|
tracks: Track[];
|
|
|
|
@Column((type) => SpotifyLibraryDetails)
|
|
spotify: SpotifyLibraryDetails;
|
|
}
|