Skip to content

Commit

Permalink
Added the logic and entities for the Genres report
Browse files Browse the repository at this point in the history
  • Loading branch information
davewalker5 committed Nov 13, 2023
1 parent 842d55c commit 65ed8a5
Show file tree
Hide file tree
Showing 20 changed files with 604 additions and 16 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.10.0.0 /opt/musiccatalogue.api-1.10.0.0
WORKDIR /opt/musiccatalogue.api-1.10.0.0/bin
COPY musiccatalogue.api-1.11.0.0 /opt/musiccatalogue.api-1.11.0.0
WORKDIR /opt/musiccatalogue.api-1.11.0.0/bin
ENTRYPOINT [ "./MusicCatalogue.Api" ]
4 changes: 2 additions & 2 deletions docker/ui/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM node:20-alpine
COPY musiccatalogue.ui-1.10.0.0 /opt/musiccatalogue.ui-1.10.0.0
WORKDIR /opt/musiccatalogue.ui-1.10.0.0
COPY musiccatalogue.ui-1.11.0.0 /opt/musiccatalogue.ui-1.11.0.0
WORKDIR /opt/musiccatalogue.ui-1.11.0.0
RUN npm install
RUN npm run build
ENTRYPOINT [ "npm", "start" ]
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.10.0.0</ReleaseVersion>
<FileVersion>1.10.0.0</FileVersion>
<ProductVersion>1.10.0</ProductVersion>
<ReleaseVersion>1.11.0.0</ReleaseVersion>
<FileVersion>1.11.0.0</FileVersion>
<ProductVersion>1.11.0</ProductVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions src/MusicCatalogue.Data/Migrations/20231113072705_GenresReport.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System.Diagnostics.CodeAnalysis;

#nullable disable

namespace MusicCatalogue.Data.Migrations
{
[ExcludeFromCodeCoverage]
/// <inheritdoc />
public partial class GenresReport : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "GenreStatistics",
columns: table => new
{
Genre = table.Column<string>(type: "TEXT", nullable: false),
Artists = table.Column<int>(type: "INTEGER", nullable: true),
Albums = table.Column<int>(type: "INTEGER", nullable: true),
Tracks = table.Column<int>(type: "INTEGER", nullable: true),
Spend = table.Column<decimal>(type: "TEXT", nullable: true)
},
constraints: table =>
{
});
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "GenreStatistics");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,27 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.ToTable("USER", (string)null);
});

modelBuilder.Entity("MusicCatalogue.Entities.Reporting.GenreStatistics", b =>
{
b.Property<int?>("Albums")
.HasColumnType("INTEGER");

b.Property<int?>("Artists")
.HasColumnType("INTEGER");

b.Property<string>("Genre")
.IsRequired()
.HasColumnType("TEXT");

b.Property<decimal?>("Spend")
.HasColumnType("TEXT");

b.Property<int?>("Tracks")
.HasColumnType("INTEGER");

b.ToTable("GenreStatistics");
});

modelBuilder.Entity("MusicCatalogue.Entities.Database.Album", b =>
{
b.HasOne("MusicCatalogue.Entities.Database.Artist", null)
Expand Down
4 changes: 2 additions & 2 deletions src/MusicCatalogue.Data/MusicCatalogue.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>MusicCatalogue.Data</PackageId>
<PackageVersion>1.10.0.0</PackageVersion>
<PackageVersion>1.11.0.0</PackageVersion>
<Authors>Dave Walker</Authors>
<Copyright>Copyright (c) Dave Walker 2023</Copyright>
<Owners>Dave Walker</Owners>
Expand All @@ -17,7 +17,7 @@
<PackageProjectUrl>https://github.com/davewalker5/MusicCatalogue</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<ReleaseVersion>1.10.0.0</ReleaseVersion>
<ReleaseVersion>1.11.0.0</ReleaseVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/MusicCatalogue.Data/MusicCatalogueDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using MusicCatalogue.Entities.Database;
using MusicCatalogue.Entities.Reporting;
using System.Diagnostics.CodeAnalysis;

namespace MusicCatalogue.Data
Expand All @@ -13,6 +14,7 @@ public class MusicCatalogueDbContext : DbContext
public virtual DbSet<Retailer> Retailers { get; set; }
public virtual DbSet<User> Users { get; set; }
public virtual DbSet<JobStatus> JobStatuses { get; set; }
public virtual DbSet<GenreStatistics> GenreStatistics { get; set; }

public MusicCatalogueDbContext(DbContextOptions<MusicCatalogueDbContext> options) : base(options)
{
Expand Down
15 changes: 15 additions & 0 deletions src/MusicCatalogue.Entities/Attributes/ExportAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace MusicCatalogue.Entities.Attributes
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class ExportAttribute : Attribute
{
public string Name { get; set; }
public int Order { get; set; }

public ExportAttribute(string name, int order) : base()
{
Name = name;
Order = order;
}
}
}
Loading

0 comments on commit 65ed8a5

Please sign in to comment.