From 57c5ada28012666a32fa9c0bc6c09abc4916c63a Mon Sep 17 00:00:00 2001 From: Phill Pover Date: Mon, 7 Apr 2025 01:37:42 +0100 Subject: [PATCH] Returning DeleteResult on deletion --- backend/src/album/album.controller.ts | 3 ++- backend/src/album/album.service.ts | 6 +++--- backend/src/song/song.controller.ts | 3 ++- backend/src/song/song.service.ts | 6 +++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/backend/src/album/album.controller.ts b/backend/src/album/album.controller.ts index 2fc9045..526d326 100644 --- a/backend/src/album/album.controller.ts +++ b/backend/src/album/album.controller.ts @@ -1,4 +1,5 @@ import { Body, Controller, Delete, Get, Param, Post, Put, UsePipes, ValidationPipe } from '@nestjs/common'; +import { DeleteResult } from 'typeorm'; import { AlbumService } from './album.service'; import { Album } from './album.entity'; import { CreateAlbumDto } from './dto/create-album.dto'; @@ -32,7 +33,7 @@ export class AlbumController { } @Delete(':id') - async remove(@Param('id') id: number): Promise { + async remove(@Param('id') id: number): Promise { return this.albumService.remove(id); } } diff --git a/backend/src/album/album.service.ts b/backend/src/album/album.service.ts index ae655e3..721bcaa 100644 --- a/backend/src/album/album.service.ts +++ b/backend/src/album/album.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; +import { DeleteResult, Repository } from 'typeorm'; import { Album } from './album.entity'; import { CreateAlbumDto } from './dto/create-album.dto'; import { UpdateAlbumDto } from './dto/update-album.dto'; @@ -59,7 +59,7 @@ export class AlbumService { } } - async remove(id: number): Promise { - await this.albumRepository.delete(id); + async remove(id: number): Promise { + return await this.albumRepository.delete(id); } } diff --git a/backend/src/song/song.controller.ts b/backend/src/song/song.controller.ts index a6d5afb..a9e76b9 100644 --- a/backend/src/song/song.controller.ts +++ b/backend/src/song/song.controller.ts @@ -1,4 +1,5 @@ import { Body, Controller, Delete, Get, Param, Post, Put, UsePipes, ValidationPipe } from '@nestjs/common'; +import { DeleteResult } from 'typeorm'; import { SongService } from './song.service'; import { Song } from './song.entity'; import { CreateSongDto } from './dto/create-song.dto'; @@ -32,7 +33,7 @@ export class SongController { } @Delete(':id') - async remove(@Param('id') id: number): Promise { + async remove(@Param('id') id: number): Promise { return this.songService.remove(id); } } diff --git a/backend/src/song/song.service.ts b/backend/src/song/song.service.ts index f1e76ac..0c433f0 100644 --- a/backend/src/song/song.service.ts +++ b/backend/src/song/song.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; -import { Repository } from 'typeorm'; +import { DeleteResult, Repository } from 'typeorm'; import { Album } from '../album/album.entity'; import { Song } from './song.entity'; import { CreateSongDto } from './dto/create-song.dto'; @@ -61,8 +61,8 @@ export class SongService { } } - async remove(id: number): Promise { - await this.songRepository.delete(id); + async remove(id: number): Promise { + return await this.songRepository.delete(id); } }