From 7c3e534111f2c03ffa1ef12bb1614a13f60cf76b Mon Sep 17 00:00:00 2001 From: Phill Pover Date: Mon, 7 Apr 2025 06:36:26 +0100 Subject: [PATCH] Fixes --- backend/src/album/album.entity.ts | 2 +- backend/src/album/album.service.ts | 4 +++- backend/src/song/song.service.ts | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/album/album.entity.ts b/backend/src/album/album.entity.ts index 19f757b..473a51a 100644 --- a/backend/src/album/album.entity.ts +++ b/backend/src/album/album.entity.ts @@ -19,7 +19,7 @@ export class Album { @Column() @IsString() - @IsNotEmpty + @IsNotEmpty() genre: string @OneToMany(() => Song, (song) => song.album, { eager: true, onDelete: 'CASCADE' }) diff --git a/backend/src/album/album.service.ts b/backend/src/album/album.service.ts index d0234f5..5e2e168 100644 --- a/backend/src/album/album.service.ts +++ b/backend/src/album/album.service.ts @@ -50,11 +50,13 @@ export class AlbumService { return null; } - const savedAlbum = await this.albumRepository.update({ id: updateAlbumDto.id }, { + await this.albumRepository.update({ id: updateAlbumDto.id }, { title: updateAlbumDto.title, artist: updateAlbumDto.artist, genre: updateAlbumDto.genre }); + const album = await this.albumRepository.findOneBy({ id: updateAlbumDto.id }); + return album; } else { console.error("AlbumService: update: IDs do not match", id, updateAlbumDto); return null; diff --git a/backend/src/song/song.service.ts b/backend/src/song/song.service.ts index e0e59b3..8450896 100644 --- a/backend/src/song/song.service.ts +++ b/backend/src/song/song.service.ts @@ -51,12 +51,13 @@ export class SongService { return null; } - const song = await this.songRepository.update({ id: updateSongDto.id }, { + await this.songRepository.update({ id: updateSongDto.id }, { title: updateSongDto.title, duration: updateSongDto.duration, trackNumber: updateSongDto.trackNumber, album: album, }); + const song = await this.songRepository.findOneBy({ id: updateSongDto.id }); return song; } else { console.error("SongService: update: IDs do not match");