There's the bug! Was doing an equal and type comparison

This commit is contained in:
Phill Pover 2025-04-07 05:21:19 +01:00
parent 1566da28ad
commit 900b9c38b7
2 changed files with 2 additions and 2 deletions

View File

@ -44,7 +44,7 @@ export class AlbumService {
async update(id: number, updateAlbumDto: UpdateAlbumDto): Promise<Album | null> { async update(id: number, updateAlbumDto: UpdateAlbumDto): Promise<Album | null> {
console.log(id, updateAlbumDto); console.log(id, updateAlbumDto);
if (id === updateAlbumDto.id) { if (id == updateAlbumDto.id) {
const albumToUpdate = await this.albumRepository.findOneBy({ id: updateAlbumDto.id }); const albumToUpdate = await this.albumRepository.findOneBy({ id: updateAlbumDto.id });
if (!albumToUpdate) { if (!albumToUpdate) {
console.log("Didn't find album: ", id); console.log("Didn't find album: ", id);

View File

@ -43,7 +43,7 @@ export class SongService {
} }
async update(id: number, updateSongDto: UpdateSongDto): Promise<Song | null> { async update(id: number, updateSongDto: UpdateSongDto): Promise<Song | null> {
if (id === updateSongDto.id) { if (id == updateSongDto.id) {
const album = await this.albumRepository.findOneBy({id: updateSongDto.albumId}); const album = await this.albumRepository.findOneBy({id: updateSongDto.albumId});
const songToUpdate = await this.songRepository.findOneBy({ id: updateSongDto.id }); const songToUpdate = await this.songRepository.findOneBy({ id: updateSongDto.id });
if (!songToUpdate || !album) if (!songToUpdate || !album)