Adds domain Music aggregate

This commit is contained in:
BinaryAlley committed 2026-09-07 09:41:57 -07:00
1 parent bde08c7440
commit 3a720af29f
100 files changed
+13077 -558

No files matched your search

@@ -2,6 +2,7 @@
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Application.Common.DataAccess.Entities.MediaContributors;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -69,7 +70,7 @@ public class BookEntity : IStorageEntity, IAuditableEntity
/// <summary>
/// Gets or sets the optional country or region of release.
/// </summary>
public string? ReleaseCountry { get; set; }
public ReleaseCountry? ReleaseCountry { get; set; }
/// <summary>
/// Gets or sets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
@@ -16,6 +16,7 @@ using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.Boo
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.ExternalIdentifiers.LibraryManagementBoundedContext.LibraryAggregate;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
using System;
using System.Collections.Generic;
@@ -63,7 +64,7 @@ public static class BookEntityMapping
Optional<int>.FromNullable(repositoryEntity.OriginalReleaseYear),
Optional<DateOnly>.FromNullable(repositoryEntity.ReReleaseDate),
Optional<int>.FromNullable(repositoryEntity.ReReleaseYear),
Optional<string>.FromNullable(repositoryEntity.ReleaseCountry),
Optional<ReleaseCountry>.FromNullable(repositoryEntity.ReleaseCountry),
Optional<string>.FromNullable(repositoryEntity.ReleaseVersion)
);
if (releaseInfoResult.IsFailure)
@@ -6,6 +6,7 @@ using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.Boo
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.Entities;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -36,7 +37,7 @@ public static class BookMetadataDtoMapping
Optional<int>.FromNullable(metadata.ReleaseInfo.OriginalReleaseYear),
Optional<DateOnly>.FromNullable(metadata.ReleaseInfo.ReReleaseDate),
Optional<int>.FromNullable(metadata.ReleaseInfo.ReReleaseYear),
Optional<string>.FromNullable(metadata.ReleaseInfo.ReleaseCountry),
Optional<ReleaseCountry>.FromNullable(metadata.ReleaseInfo.ReleaseCountry),
Optional<string>.FromNullable(metadata.ReleaseInfo.ReleaseVersion)
);
if (releaseInfoResult.IsFailure)
@@ -18,6 +18,7 @@ using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.Boo
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.BookLibraryAggregate.ValueObjects;
using Lumina.Domain.Core.BoundedContexts.WrittenContentLibraryBoundedContext.ExternalIdentifiers.LibraryManagementBoundedContext.LibraryAggregate;
using Lumina.Domain.SharedKernel.Common.Enums.BookLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
using System;
using System.Collections.Generic;
@@ -122,7 +123,7 @@ public class AddBookCommandHandler : ICommandHandler<AddBookCommand, Result<Book
Optional<int>.FromNullable(command.Metadata.ReleaseInfo.OriginalReleaseYear),
Optional<DateOnly>.FromNullable(command.Metadata.ReleaseInfo.ReReleaseDate),
Optional<int>.FromNullable(command.Metadata.ReleaseInfo.ReReleaseYear),
Optional<string>.FromNullable(command.Metadata.ReleaseInfo.ReleaseCountry),
Optional<ReleaseCountry>.FromNullable(command.Metadata.ReleaseInfo!.ReleaseCountry),
Optional<string>.FromNullable(command.Metadata.ReleaseInfo.ReleaseVersion)
);
if (releaseInfoResult.IsFailure)
@@ -64,11 +64,6 @@ public class AddBookCommandValidator : AbstractValidator<AddBookCommand>
.When(r => r!.ReReleaseYear.HasValue)
.WithError(Errors.Metadata.ReReleaseYearMustBeBetween1And9999);
releaseInfo.RuleFor(r => r!.ReleaseCountry)
.Matches("^[A-Za-z]{2}$")
.When(r => r!.ReleaseCountry is not null)
.WithError(Errors.Metadata.CountryCodeMustBe2CharactersLong);
releaseInfo.RuleFor(r => r!.ReleaseVersion)
.MaximumLength(50)
.When(r => r!.ReleaseVersion is not null)
@@ -60,11 +60,6 @@ public class UpdateBookCommandValidator : AbstractValidator<UpdateBookCommand>
.When(r => r!.ReReleaseYear.HasValue)
.WithError(Errors.Metadata.ReReleaseYearMustBeBetween1And9999);
releaseInfo.RuleFor(r => r!.ReleaseCountry)
.Matches("^[A-Za-z]{2}$")
.When(r => r!.ReleaseCountry is not null)
.WithError(Errors.Metadata.CountryCodeMustBe2CharactersLong);
releaseInfo.RuleFor(r => r!.ReleaseVersion)
.MaximumLength(50)
.When(r => r!.ReleaseVersion is not null)