Adds refactoring

This commit is contained in:
BinaryAlley committed 2024-08-26 23:32:38 +03:00
1 parent 8b729cc16c
commit ddfaaefa27
39 files changed
+673 -396

No files matched your search

@@ -14,7 +14,7 @@ namespace Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggrega
/// Aggregate Root for a media contributor.
/// </summary>
[DebuggerDisplay("{Id}: {Name}")]
public class MediaContributor : AggregateRoot<MediaContributorId, Guid>
public class MediaContributor : AggregateRoot<MediaContributorId>
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
@@ -7,23 +7,15 @@ namespace Lumina.Domain.Core.Aggregates.MediaContributor.MediaContributorAggrega
/// <summary>
/// Value Object for the Id of a media contributor.
/// </summary>
public sealed class MediaContributorId : AggregateRootId<Guid>
public sealed class MediaContributorId : EntityId<Guid>
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the value of this object.
/// </summary>
public override Guid Value { get; protected set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="MediaContributorId"/> class.
/// </summary>
/// <param name="value">The value representing this object.</param>
private MediaContributorId(Guid value)
private MediaContributorId(Guid value) : base(value)
{
Value = value;
}
#endregion
@@ -16,11 +16,11 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
/// Aggregate root for a book.
/// </summary>
[DebuggerDisplay("{Id}: {Title}")]
public sealed class Book : AggregateRoot<BookId, Guid>
public sealed class Book : AggregateRoot<BookId>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<MediaContributorId> _contributors;
private readonly List<Rating> _ratings;
private readonly List<BookRating> _ratings;
private readonly List<Isbn> _isbns;
#endregion
@@ -114,7 +114,7 @@ public sealed class Book : AggregateRoot<BookId, Guid>
/// <summary>
/// Gets the list of ratings for this book.
/// </summary>
public IReadOnlyCollection<Rating> Ratings
public IReadOnlyCollection<BookRating> Ratings
{
get { return _ratings.AsReadOnly(); }
}
@@ -160,7 +160,7 @@ public sealed class Book : AggregateRoot<BookId, Guid>
Optional<string> appleBooksId,
List<Isbn> isbns,
List<MediaContributorId> contributors,
List<Rating> ratings) : base(id)
List<BookRating> ratings) : base(id)
{
Id = id;
Metadata = metadata;
@@ -234,7 +234,7 @@ public sealed class Book : AggregateRoot<BookId, Guid>
Optional<string> appleBooksId,
List<Isbn> isbns,
List<MediaContributorId> contributors,
List<Rating> ratings)
List<BookRating> ratings)
{
// TODO: enforce invariants
return new Book(
@@ -300,7 +300,7 @@ public sealed class Book : AggregateRoot<BookId, Guid>
Optional<string> appleBooksId,
List<Isbn> isbns,
List<MediaContributorId> contributors,
List<Rating> ratings)
List<BookRating> ratings)
{
// TODO: enforce invariants
return new Book(
@@ -7,23 +7,15 @@ namespace Lumina.Domain.Core.Aggregates.WrittenContentLibrary.BookLibraryAggrega
/// <summary>
/// Value Object for the Id of a book.
/// </summary>
public sealed class BookId : AggregateRootId<Guid>
public sealed class BookId : EntityId<Guid>
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the value of the <see cref="BookId"/>.
/// </summary>
public override Guid Value { get; protected set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BookId"/> class.
/// </summary>
/// <param name="value">The value representing this object.</param>
private BookId(Guid value)
private BookId(Guid value) : base(value)
{
Value = value;
}
#endregion