Skip to content

Commit

Permalink
Added album deletion endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
davewalker5 committed Nov 9, 2023
1 parent 7c18400 commit 55613cb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 2 additions & 2 deletions docker/api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/core/aspnet:latest
COPY musiccatalogue.api-1.7.0.0 /opt/musiccatalogue.api-1.7.0.0
WORKDIR /opt/musiccatalogue.api-1.7.0.0/bin
COPY musiccatalogue.api-1.8.0.0 /opt/musiccatalogue.api-1.8.0.0
WORKDIR /opt/musiccatalogue.api-1.8.0.0/bin
ENTRYPOINT [ "./MusicCatalogue.Api" ]
16 changes: 16 additions & 0 deletions src/MusicCatalogue.Api/Controllers/AlbumsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,21 @@ public async Task<ActionResult<IEnumerable<Album>>> GetAlbumsByArtistAsync(int a

return albums;
}

[HttpDelete]
[Route("{id}")]
public async Task<IActionResult> DeleteAlbum(int id)
{
// Check the album exists, first
var album = await _factory.Albums.GetAsync(x => x.Id == id);
if (album == null)
{
return NotFound();
}

// It does, so delete it
await _factory.Albums.DeleteAsync(id);
return Ok();
}
}
}
6 changes: 3 additions & 3 deletions src/MusicCatalogue.Api/MusicCatalogue.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ReleaseVersion>1.7.0.0</ReleaseVersion>
<FileVersion>1.7.0.0</FileVersion>
<ProductVersion>1.7.0</ProductVersion>
<ReleaseVersion>1.8.0.0</ReleaseVersion>
<FileVersion>1.8.0.0</FileVersion>
<ProductVersion>1.8.0</ProductVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down

0 comments on commit 55613cb

Please sign in to comment.