-
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.
- Loading branch information
1 parent
72c010f
commit dbc51aa
Showing
30 changed files
with
349 additions
and
88 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
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.25.0.0 /opt/musiccatalogue.api-1.25.0.0 | ||
WORKDIR /opt/musiccatalogue.api-1.25.0.0/bin | ||
COPY musiccatalogue.api-1.30.0.0 /opt/musiccatalogue.api-1.30.0.0 | ||
WORKDIR /opt/musiccatalogue.api-1.30.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.29.0.0 /opt/musiccatalogue.ui-1.29.0.0 | ||
WORKDIR /opt/musiccatalogue.ui-1.29.0.0 | ||
COPY musiccatalogue.ui-1.30.0.0 /opt/musiccatalogue.ui-1.30.0.0 | ||
WORKDIR /opt/musiccatalogue.ui-1.30.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
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,8 @@ | ||
namespace MusicCatalogue.Api.Entities | ||
{ | ||
public class GenreAlbumsExportWorkItem : BackgroundWorkItem | ||
{ | ||
public string FileName { get; set; } = ""; | ||
public int GenreId { get; set; } | ||
} | ||
} |
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
45 changes: 45 additions & 0 deletions
45
src/MusicCatalogue.Api/Services/GenreAlbumsExportService.cs
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,45 @@ | ||
using Microsoft.Extensions.Options; | ||
using MusicCatalogue.Api.Entities; | ||
using MusicCatalogue.Api.Interfaces; | ||
using MusicCatalogue.Entities.Config; | ||
using MusicCatalogue.Entities.Interfaces; | ||
using MusicCatalogue.Entities.Reporting; | ||
using MusicCatalogue.Logic.DataExchange.Generic; | ||
|
||
namespace MusicCatalogue.Api.Services | ||
{ | ||
public class GenreAlbumsExportService : BackgroundQueueProcessor<GenreAlbumsExportWorkItem> | ||
{ | ||
private readonly MusicApplicationSettings _settings; | ||
public GenreAlbumsExportService( | ||
ILogger<BackgroundQueueProcessor<GenreAlbumsExportWorkItem>> logger, | ||
IBackgroundQueue<GenreAlbumsExportWorkItem> queue, | ||
IServiceScopeFactory serviceScopeFactory, | ||
IOptions<MusicApplicationSettings> settings) | ||
: base(logger, queue, serviceScopeFactory) | ||
{ | ||
_settings = settings.Value; | ||
} | ||
|
||
/// <summary> | ||
/// Export the albums by genre report | ||
/// </summary> | ||
/// <param name="item"></param> | ||
/// <param name="factory"></param> | ||
/// <returns></returns> | ||
protected override async Task ProcessWorkItem(GenreAlbumsExportWorkItem item, IMusicCatalogueFactory factory) | ||
{ | ||
// Get the report data | ||
MessageLogger.LogInformation("Retrieving the albums by genre report for export"); | ||
var records = await factory.GenreAlbums.GenerateReportAsync(item.GenreId, 1, int.MaxValue); | ||
|
||
// Construct the full path to the export file | ||
var filePath = Path.Combine(_settings.ReportsExportPath, item.FileName); | ||
|
||
// Export the report | ||
var exporter = new CsvExporter<GenreAlbum>(); | ||
exporter.Export(records, filePath, ','); | ||
MessageLogger.LogInformation("Albums by genre report export completed"); | ||
} | ||
} | ||
} |
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
1 change: 0 additions & 1 deletion
1
src/MusicCatalogue.Entities/Exceptions/MalformedCommandLineException.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
SELECT RANK() OVER ( ORDER BY ar.Name, al.Title ) AS 'Id', | ||
ar.Name AS 'Artist', | ||
al.Title, g.Name AS 'Genre', | ||
IFNULL( DATE(al.Purchased), DATE('1900-01-01')) AS 'Purchased', | ||
IFNULL( al.Price, 0 ) AS 'Price', | ||
r.Name AS 'Retailer' | ||
FROM ALBUMS al | ||
INNER JOIN GENRES g ON g.Id = al.GenreId | ||
INNER JOIN ARTISTS ar ON ar.Id = al.ArtistId | ||
INNER JOIN RETAILERS r ON r.Id = al.RetailerId | ||
WHERE g.Id = $genreId | ||
AND IFNULL( al.IsWishListItem, 0 ) = 0 | ||
ORDER BY ar.Name ASC, | ||
al.Title ASC | ||
SELECT RANK() OVER ( ORDER BY ar.Name, al.Title ) AS 'Id', | ||
ar.Name AS 'Artist', | ||
al.Title, | ||
g.Name AS 'Genre', | ||
IFNULL( al.Released, 0 ) AS 'Released', | ||
IFNULL( DATE(al.Purchased), DATE('1900-01-01')) AS 'Purchased', | ||
IFNULL( al.Price, 0.0 ) AS 'Price', | ||
IFNULL( r.Name, '') AS 'Retailer' | ||
FROM ALBUMS al | ||
INNER JOIN GENRES g ON g.Id = al.GenreId | ||
INNER JOIN ARTISTS ar ON ar.Id = al.ArtistId | ||
LEFT OUTER JOIN RETAILERS r ON r.Id = al.RetailerId | ||
WHERE g.Id = $genreId | ||
AND IFNULL( al.IsWishListItem, 0 ) = 0 | ||
ORDER BY ar.Name ASC, | ||
al.Title ASC |
Oops, something went wrong.