mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 19:21:10 +00:00
Adds domain Music aggregate
This commit is contained in:
1 parent
bde08c7440
commit
3a720af29f
100 files changed
+13077
-558
No files matched your search
@@ -22,6 +22,7 @@ public static partial class Errors
|
||||
public static Error TagsListCannotBeNull => Error.Validation(description: nameof(TagsListCannotBeNull));
|
||||
public static Error TagNameCannotBeEmpty => Error.Validation(description: nameof(TagNameCannotBeEmpty));
|
||||
public static Error TagNameMustBeMaximum50CharactersLong => Error.Validation(description: nameof(TagNameMustBeMaximum50CharactersLong));
|
||||
public static Error MoodNameCannotBeEmpty => Error.Validation(description: nameof(MoodNameCannotBeEmpty));
|
||||
public static Error LanguageCodeCannotBeEmpty => Error.Validation(description: nameof(LanguageCodeCannotBeEmpty));
|
||||
public static Error LanguageNameCannotBeEmpty => Error.Validation(description: nameof(LanguageNameCannotBeEmpty));
|
||||
public static Error LanguageCodeMustBe2CharactersLong => Error.Validation(description: nameof(LanguageCodeMustBe2CharactersLong));
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Common.Errors;
|
||||
|
||||
/// <summary>
|
||||
/// Music error types.
|
||||
/// </summary>
|
||||
public static partial class Errors
|
||||
{
|
||||
public static class Music
|
||||
{
|
||||
public static Error ArtistNameCannotBeEmpty => Error.Validation(description: nameof(ArtistNameCannotBeEmpty));
|
||||
public static Error MusicBrainzIdInvalidFormat => Error.Validation(description: nameof(MusicBrainzIdInvalidFormat));
|
||||
public static Error IsrcValueCannotBeEmpty => Error.Validation(description: nameof(IsrcValueCannotBeEmpty));
|
||||
public static Error IsrcInvalidFormat => Error.Validation(description: nameof(IsrcInvalidFormat));
|
||||
public static Error BarcodeValueCannotBeEmpty => Error.Validation(description: nameof(BarcodeValueCannotBeEmpty));
|
||||
public static Error InvalidFormatForBarcode => Error.Validation(description: nameof(InvalidFormatForBarcode));
|
||||
public static Error CreditRoleDisplayNameCannotBeEmpty => Error.Validation(description: nameof(CreditRoleDisplayNameCannotBeEmpty));
|
||||
public static Error TheArtistAlreadyHasTheAlbum => Error.Forbidden(description: nameof(TheArtistAlreadyHasTheAlbum));
|
||||
public static Error TheArtistDoesNotHaveTheAlbum => Error.Forbidden(description: nameof(TheArtistDoesNotHaveTheAlbum));
|
||||
public static Error TheTrackIsAlreadyInTheAlbum => Error.Forbidden(description: nameof(TheTrackIsAlreadyInTheAlbum));
|
||||
public static Error TheTrackIsNotInTheAlbum => Error.Forbidden(description: nameof(TheTrackIsNotInTheAlbum));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Models.Core;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Domain.Common.ValueObjects.Metadata;
|
||||
|
||||
/// <summary>
|
||||
/// Value Object for the moods of a media element.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Name}")]
|
||||
public class Mood : ValueObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the name of the mood element of the media item.
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="Mood"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The value representing this object.</param>
|
||||
private Mood(string name)
|
||||
{
|
||||
Name = name.Trim();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="Mood"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The value of the mood.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="Result{TValue}"/> containing either a successfully created <see cref="Mood"/>, or an error message.
|
||||
/// </returns>
|
||||
public static Result<Mood> Create(string? name)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(name))
|
||||
return Errors.Errors.Metadata.MoodNameCannotBeEmpty;
|
||||
return new Mood(name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of items that define equality of the object.
|
||||
/// </summary>
|
||||
/// <returns>A list of items defining the equality.</returns>
|
||||
public override IEnumerable<object> GetEqualityComponents()
|
||||
{
|
||||
yield return Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Customized ToString() method.
|
||||
/// </summary>
|
||||
/// <returns>Custom string value showing relevant data for current class.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Models.Core;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
@@ -38,7 +39,7 @@ public class ReleaseInfo : ValueObject
|
||||
/// <summary>
|
||||
/// Gets the optional country or region of release.
|
||||
/// </summary>
|
||||
public Optional<string> ReleaseCountry { get; }
|
||||
public Optional<ReleaseCountry> ReleaseCountry { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the optional release version or edition. (e.g. "Original", "Director's Cut", "2.0")
|
||||
@@ -59,7 +60,7 @@ public class ReleaseInfo : ValueObject
|
||||
Optional<int> originalReleaseYear,
|
||||
Optional<DateOnly> reReleaseDate,
|
||||
Optional<int> reReleaseYear,
|
||||
Optional<string> releaseCountry,
|
||||
Optional<ReleaseCountry> releaseCountry,
|
||||
Optional<string> releaseVersion)
|
||||
{
|
||||
OriginalReleaseDate = originalReleaseDate;
|
||||
@@ -87,7 +88,7 @@ public class ReleaseInfo : ValueObject
|
||||
Optional<int> originalReleaseYear,
|
||||
Optional<DateOnly> reReleaseDate,
|
||||
Optional<int> reReleaseYear,
|
||||
Optional<string> releaseCountry,
|
||||
Optional<ReleaseCountry> releaseCountry,
|
||||
Optional<string> releaseVersion)
|
||||
{
|
||||
if (originalReleaseDate.HasValue && originalReleaseYear.HasValue && originalReleaseDate.Value.Year != originalReleaseYear.Value)
|
||||
|
||||
Reference in new issue
Block a user