eliminates region sections

This commit is contained in:
BinaryAlley committed 2024-10-12 22:03:57 +03:00
1 parent 705c02b90d
commit 405fc1ff9a
370 files changed
+47 -1618

No files matched your search

@@ -16,7 +16,6 @@ namespace Lumina.Domain.Common.DependencyInjection;
/// </summary>
public static class DomainLayerServices
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Registers the services of the Domain layer into the dependency injection container.
/// </summary>
@@ -44,5 +43,4 @@ public static class DomainLayerServices
services.AddSingleton<IFileSystem, FileSystem>();
return services;
}
#endregion
}
@@ -11,7 +11,6 @@ public static partial class Errors
{
public static class FileManagement
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error ParentNodeCannotBeNull => Error.Failure(nameof(ParentNodeCannotBeNull));
public static Error FileCopyError => Error.Failure(nameof(FileCopyError));
public static Error FileMoveError => Error.Failure(nameof(FileMoveError));
@@ -29,6 +28,5 @@ public static partial class Errors
public static Error FileAlreadyExists => Error.Conflict(nameof(FileAlreadyExists));
public static Error DirectoryNotFound => Error.NotFound(nameof(DirectoryNotFound));
public static Error DirectoryAlreadyExists => Error.Conflict(nameof(DirectoryAlreadyExists));
#endregion
}
}
}
@@ -10,9 +10,7 @@ namespace Lumina.Domain.Common.Errors;
public static partial class Errors
{
public static class MediaContributor
{
#region ==================================================================== PROPERTIES =================================================================================
{
public static Error ContributorsListCannotBeNull => Error.Validation(nameof(ContributorsListCannotBeNull));
public static Error ContributorNameCannotBeEmpty => Error.Validation(nameof(ContributorNameCannotBeEmpty));
public static Error ContributorDisplayNameCannotBeEmpty => Error.Validation(nameof(ContributorDisplayNameCannotBeEmpty));
@@ -23,6 +21,5 @@ public static partial class Errors
public static Error RoleCategoryCannotBeEmpty => Error.Validation(nameof(RoleCategoryCannotBeEmpty));
public static Error RoleCategoryMustBeMaximum50CharactersLong => Error.Validation(nameof(RoleCategoryMustBeMaximum50CharactersLong));
public static Error ContributorRoleCannotBeNull => Error.Validation(nameof(ContributorRoleCannotBeNull));
#endregion
}
}
}
@@ -11,7 +11,6 @@ public static partial class Errors
{
public static class Metadata
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error MetadataCannotBeNull => Error.Validation(nameof(MetadataCannotBeNull));
public static Error TitleCannotBeEmpty => Error.Validation(nameof(TitleCannotBeEmpty));
public static Error TitleMustBeMaximum255CharactersLong => Error.Validation(nameof(TitleMustBeMaximum255CharactersLong));
@@ -43,6 +42,5 @@ public static partial class Errors
public static Error RatingVoteCountMustBePositive => Error.Validation(nameof(RatingVoteCountMustBePositive));
public static Error RatingsListCannotBeNull => Error.Validation(nameof(RatingsListCannotBeNull));
public static Error InvalidIsoCode => Error.Validation(nameof(InvalidIsoCode));
#endregion
}
}
}
@@ -1,4 +1,4 @@
#region ========================================================================= USING =====================================================================================
#region ========================================================================= USING =====================================================================================
using ErrorOr;
#endregion
@@ -11,8 +11,6 @@ public static partial class Errors
{
public static class Permission
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error UnauthorizedAccess => Error.Failure(nameof(UnauthorizedAccess));
#endregion
}
}
}
@@ -11,9 +11,7 @@ public static partial class Errors
{
public static class Thumbnails
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error NoThumbnail => Error.Failure(nameof(NoThumbnail));
public static Error ImageQaulityMustBeBetweenZeroAndOneHundred => Error.Validation(nameof(ImageQaulityMustBeBetweenZeroAndOneHundred));
#endregion
}
}
@@ -11,7 +11,6 @@ public static partial class Errors
{
public static class WrittenContent
{
#region ==================================================================== PROPERTIES =================================================================================
public static Error BookAlreadyExists => Error.Conflict(nameof(BookAlreadyExists));
public static Error IsbnValueCannotBeEmpty => Error.Validation(nameof(IsbnValueCannotBeEmpty));
public static Error IsbnListCannotBeNull => Error.Validation(nameof(IsbnListCannotBeNull));
@@ -36,6 +35,5 @@ public static partial class Errors
public static Error UnknownBookFormat => Error.Validation(nameof(UnknownBookFormat));
public static Error EditionMustBeMaximum50CharactersLong => Error.Validation(nameof(EditionMustBeMaximum50CharactersLong));
public static Error VolumeNumberMustBeGreaterThanZero => Error.Validation(nameof(VolumeNumberMustBeGreaterThanZero));
#endregion
}
}
}
@@ -9,7 +9,6 @@ namespace Lumina.Domain.Common.Events;
/// </summary>
public interface IDomainEvent
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the id of the domain event.
/// </summary>
@@ -19,5 +18,4 @@ public interface IDomainEvent
/// Gets the date and time when the domain event occurred.
/// </summary>
DateTime OccurredOn { get; }
#endregion
}
@@ -6,7 +6,6 @@
/// <typeparam name="TId">The type representing the unique identifier for the Aggregate Root. It should be a non-nullable type.</typeparam>
public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
/// </summary>
@@ -25,5 +24,4 @@ public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
}
#pragma warning restore CS8618
#endregion
}
@@ -10,7 +10,6 @@ namespace Lumina.Domain.Common.Models.Core;
/// <typeparam name="TId">The type representing the unique identifier for the Entity. It should be a non-nullable type.</typeparam>
public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the unique identifier of the entity.
/// </summary>
@@ -25,9 +24,7 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
/// Gets the date and time when the entity was last updated.
/// </summary>
public DateTime? Updated { get; set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Entity{TId}"/> class.
/// </summary>
@@ -46,9 +43,7 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
}
#pragma warning restore CS8618
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
@@ -99,5 +94,4 @@ public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
{
return Id.GetHashCode();
}
#endregion
}
@@ -12,14 +12,11 @@ namespace Lumina.Domain.Common.Models.Core;
[DebuggerDisplay("{Value}")]
public abstract class EntityId<TId> : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the value representing the entity identifier.
/// </summary>
public TId Value { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="EntityId{TId}"/> class.
/// </summary>
@@ -37,9 +34,7 @@ public abstract class EntityId<TId> : ValueObject
{
}
#pragma warning restore CS8618
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
@@ -57,5 +52,4 @@ public abstract class EntityId<TId> : ValueObject
{
return Value?.ToString() ?? base.ToString();
}
#endregion
}
@@ -11,7 +11,6 @@ namespace Lumina.Domain.Common.Models.Core;
/// </summary>
public abstract class ValueObject : IEquatable<ValueObject>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
@@ -72,5 +71,4 @@ public abstract class ValueObject : IEquatable<ValueObject>
return GetEqualityComponents().Select(x => x?.GetHashCode() ?? 0)
.Aggregate((x, y) => x ^ y);
}
#endregion
}
@@ -7,11 +7,8 @@ namespace Lumina.Domain.Common.Primitives;
/// <typeparam name="TValue">The type of the value represented by this structure.</typeparam>
public readonly struct Optional<TValue>
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly TValue? _value;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets a value indicating whether this structure has a value.
/// </summary>
@@ -21,9 +18,7 @@ public readonly struct Optional<TValue>
/// Gets the value represented by this structure.
/// </summary>
public TValue Value => HasValue ? _value! : default!;
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Optional{TValue}"/> structure.
/// </summary>
@@ -34,9 +29,7 @@ public readonly struct Optional<TValue>
_value = value;
HasValue = hasValue;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Custom implementation operator for converting <paramref name="value"/> to an <see cref="Optional{TValue}"/>.
/// </summary>
@@ -94,5 +87,4 @@ public readonly struct Optional<TValue>
{
return HasValue ? Value?.ToString()! : string.Empty;
}
#endregion
}
@@ -14,12 +14,9 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{Title}")]
public abstract class BaseMetadata : ValueObject
{
#region ================================================================== FIELD MEMBERS ================================================================================
private readonly List<Tag> _tags;
private readonly List<Genre> _genres;
#endregion
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the title of the media item.
/// </summary>
@@ -59,9 +56,7 @@ public abstract class BaseMetadata : ValueObject
/// Gets the list of genres associated with the media item.
/// </summary>
public IReadOnlyCollection<Genre> Genres => _genres.AsReadOnly();
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="BaseMetadata"/> class.
/// </summary>
@@ -93,9 +88,7 @@ public abstract class BaseMetadata : ValueObject
Language = language;
OriginalLanguage = originalLanguage;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <inheritdoc/>
public override IEnumerable<object> GetEqualityComponents()
{
@@ -110,5 +103,4 @@ public abstract class BaseMetadata : ValueObject
yield return Language;
yield return OriginalLanguage;
}
#endregion
}
@@ -13,14 +13,11 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{Name}")]
public class Genre : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the name of the genre element of the media item.
/// </summary>
public string Name { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Genre"/> class.
/// </summary>
@@ -29,9 +26,7 @@ public class Genre : ValueObject
{
Name = name.Trim();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Genre"/> class.
/// </summary>
@@ -60,5 +55,4 @@ public class Genre : ValueObject
{
return Name;
}
#endregion
}
@@ -14,7 +14,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{LanguageCode}")]
public class LanguageInfo : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the ISO 639-1 two-letter language code.
/// </summary>
@@ -29,9 +28,7 @@ public class LanguageInfo : ValueObject
/// Gets an optional native name of the language.
/// </summary>
public Optional<string> NativeName { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="LanguageInfo"/> class.
/// </summary>
@@ -44,9 +41,7 @@ public class LanguageInfo : ValueObject
LanguageName = languageName;
NativeName = nativeName;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="LanguageInfo"/> class.
/// </summary>
@@ -83,5 +78,4 @@ public class LanguageInfo : ValueObject
{
return $"{LanguageCode} - {LanguageName}";
}
#endregion
}
@@ -12,7 +12,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{Value}/{MaxValue}")]
public abstract class Rating : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the numeric value of the rating.
/// </summary>
@@ -27,9 +26,7 @@ public abstract class Rating : ValueObject
/// Gets the optional number of votes or reviews this rating is based on.
/// </summary>
public Optional<int> VoteCount { get; private set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Rating"/> class.
/// </summary>
@@ -42,9 +39,7 @@ public abstract class Rating : ValueObject
MaxValue = maxValue;
VoteCount = voteCount;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Returns the rating as a percentage.
/// </summary>
@@ -53,5 +48,4 @@ public abstract class Rating : ValueObject
{
return Value / MaxValue * 100;
}
#endregion
}
@@ -15,7 +15,6 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{ReleaseYear}")]
public class ReleaseInfo : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the optional original release date of the media item.
/// </summary>
@@ -46,9 +45,7 @@ public class ReleaseInfo : ValueObject
/// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
/// </summary>
public Optional<string> ReleaseVersion { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="ReleaseInfo"/> class.
/// </summary>
@@ -73,9 +70,7 @@ public class ReleaseInfo : ValueObject
ReleaseCountry = releaseCountry;
ReleaseVersion = releaseVersion;
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="ReleaseInfo"/> class.
/// </summary>
@@ -117,5 +112,4 @@ public class ReleaseInfo : ValueObject
yield return ReleaseCountry;
yield return ReleaseVersion;
}
#endregion
}
@@ -13,14 +13,11 @@ namespace Lumina.Domain.Common.ValueObjects.Metadata;
[DebuggerDisplay("{Name}")]
public class Tag : ValueObject
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the name of the tag element of the media item.
/// </summary>
public string Name { get; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Tag"/> class.
/// </summary>
@@ -29,9 +26,7 @@ public class Tag : ValueObject
{
Name = name.Trim();
}
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Creates a new instance of the <see cref="Tag"/> class.
/// </summary>
@@ -60,5 +55,4 @@ public class Tag : ValueObject
{
return Name;
}
#endregion
}