mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
feat: top genres report
This commit is contained in:
parent
62119d44b0
commit
a0c28e2324
21 changed files with 317 additions and 104 deletions
|
|
@ -8,7 +8,6 @@ import {
|
|||
} from "typeorm";
|
||||
import { SpotifyLibraryDetails } from "../sources/spotify/spotify-library-details.entity";
|
||||
import { Artist } from "./artist.entity";
|
||||
import { Genre } from "./genre.entity";
|
||||
import { Track } from "./track.entity";
|
||||
|
||||
@Entity()
|
||||
|
|
@ -26,9 +25,6 @@ export class Album {
|
|||
@OneToMany(() => Track, (track) => track.album)
|
||||
tracks?: Track[];
|
||||
|
||||
@ManyToMany(() => Genre)
|
||||
genres?: Genre[];
|
||||
|
||||
@Column(() => SpotifyLibraryDetails)
|
||||
spotify: SpotifyLibraryDetails;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
import { Column, Entity, ManyToMany, PrimaryGeneratedColumn } from "typeorm";
|
||||
import {
|
||||
Column,
|
||||
Entity,
|
||||
JoinTable,
|
||||
ManyToMany,
|
||||
PrimaryGeneratedColumn,
|
||||
} from "typeorm";
|
||||
import { SpotifyLibraryDetails } from "../sources/spotify/spotify-library-details.entity";
|
||||
import { Album } from "./album.entity";
|
||||
import { Genre } from "./genre.entity";
|
||||
|
|
@ -15,6 +21,7 @@ export class Artist {
|
|||
albums?: Album[];
|
||||
|
||||
@ManyToMany(() => Genre)
|
||||
@JoinTable({ name: "artist_genres" })
|
||||
genres?: Genre[];
|
||||
|
||||
@Column(() => SpotifyLibraryDetails)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
import { SpotifyLibraryDetails } from "../../sources/spotify/spotify-library-details.entity";
|
||||
import { Artist } from "../artist.entity";
|
||||
import { Genre } from "../genre.entity";
|
||||
|
||||
export class CreateAlbumDto {
|
||||
name: string;
|
||||
artists: Artist[];
|
||||
genres: Genre[];
|
||||
spotify?: SpotifyLibraryDetails;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ export class MusicLibraryService {
|
|||
const artist = this.artistRepository.create();
|
||||
|
||||
artist.name = data.name;
|
||||
artist.genres = data.genres;
|
||||
artist.spotify = data.spotify;
|
||||
|
||||
try {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue