-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from davewalker5/MC-219-Track-Editor
MC-219 Add a Track Editor
- Loading branch information
Showing
26 changed files
with
596 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.21.0.0 /opt/musiccatalogue.api-1.21.0.0 | ||
WORKDIR /opt/musiccatalogue.api-1.21.0.0/bin | ||
COPY musiccatalogue.api-1.22.0.0 /opt/musiccatalogue.api-1.22.0.0 | ||
WORKDIR /opt/musiccatalogue.api-1.22.0.0/bin | ||
ENTRYPOINT [ "./MusicCatalogue.Api" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
FROM node:20-alpine | ||
COPY musiccatalogue.ui-1.24.0.0 /opt/musiccatalogue.ui-1.24.0.0 | ||
WORKDIR /opt/musiccatalogue.ui-1.24.0.0 | ||
COPY musiccatalogue.ui-1.25.0.0 /opt/musiccatalogue.ui-1.25.0.0 | ||
WORKDIR /opt/musiccatalogue.ui-1.25.0.0 | ||
RUN npm install | ||
RUN npm run build | ||
ENTRYPOINT [ "npm", "start" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
using MusicCatalogue.Entities.Database; | ||
using MusicCatalogue.Entities.Interfaces; | ||
|
||
namespace MusicCatalogue.Api.Controllers | ||
{ | ||
[Authorize] | ||
[ApiController] | ||
[ApiConventionType(typeof(DefaultApiConventions))] | ||
[Route("[controller]")] | ||
public class TracksController : Controller | ||
{ | ||
private readonly IMusicCatalogueFactory _factory; | ||
|
||
public TracksController(IMusicCatalogueFactory factory) | ||
{ | ||
_factory = factory; | ||
} | ||
|
||
/// <summary> | ||
/// Add a track to the catalogue | ||
/// </summary> | ||
/// <param name="id"></param> | ||
/// <returns></returns> | ||
[HttpPost] | ||
[Route("")] | ||
public async Task<ActionResult<Track>> AddTrackAsync([FromBody] Track template) | ||
{ | ||
var track = await _factory.Tracks.AddAsync(template.AlbumId, template.Title, template.Number, template.Duration); | ||
return track; | ||
} | ||
|
||
/// <summary> | ||
/// Update an existing track | ||
/// </summary> | ||
/// <param name="id"></param> | ||
/// <returns></returns> | ||
[HttpPut] | ||
[Route("")] | ||
public async Task<ActionResult<Track?>> UpdateTrackAsync([FromBody] Track template) | ||
{ | ||
var track = await _factory.Tracks.UpdateAsync( | ||
template.Id, | ||
template.AlbumId, | ||
template.Title, | ||
template.Number, | ||
template.Duration); | ||
return track; | ||
} | ||
|
||
/// <summary> | ||
/// Delete an existing track | ||
/// </summary> | ||
/// <param name="id"></param> | ||
/// <returns></returns> | ||
[HttpDelete] | ||
[Route("{id}")] | ||
public async Task<IActionResult> DeleteTrackAsync(int id) | ||
{ | ||
// Make sure the track exists | ||
var track = await _factory.Tracks.GetAsync(x => x.Id == id); | ||
|
||
// If the track doesn't exist, return a 404 | ||
if (track == null) | ||
{ | ||
return NotFound(); | ||
} | ||
|
||
// Delete the track | ||
await _factory.Tracks.DeleteAsync(id); | ||
|
||
return Ok(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.