Partypack/Server/Source/Schemas/User.ts

19 lines
510 B
TypeScript
Raw Normal View History

2024-01-24 01:35:47 +01:00
import { BaseEntity, Column, Entity, JoinTable, ManyToMany, OneToMany, PrimaryColumn } from "typeorm";
import { Song } from "./Song";
2024-01-24 01:35:47 +01:00
import { Rating } from "./Rating";
@Entity()
export class User extends BaseEntity {
@PrimaryColumn()
ID: string;
@Column({ type: "simple-json" })
Library: { SongID: string, Overriding: string }[];
2024-01-24 01:35:47 +01:00
@OneToMany(() => Rating, R => R.Author)
Ratings: Rating[];
@ManyToMany(() => Song, { eager: true })
@JoinTable()
BookmarkedSongs: Song[];
}