Refactors the book, artist, and album slices across the stack

This commit is contained in:
BinaryAlley committed 2026-09-17 13:30:48 -07:00
1 parent 8aaf9fe64e
commit ea6eb9f796
439 files changed
+28235 -3156

No files matched your search

@@ -0,0 +1,56 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for the participation of a media contributor in an album, carrying the role the contributor played in that album.
/// The role is tracked per participation, so that a single contributor can play multiple roles in the same album, or different roles in different albums.
/// </summary>
[DebuggerDisplay("AlbumId: {AlbumId} MediaContributorId: {MediaContributorId}")]
public class AlbumContributorEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets the Id of the participation.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets the Id of the album the contributor participated in.
/// </summary>
public required Guid AlbumId { get; init; }
/// <summary>
/// Gets the Id of the media contributor.
/// </summary>
public required Guid MediaContributorId { get; init; }
/// <summary>
/// Gets the role the contributor played in the album.
/// </summary>
public required MediaContributorRole Role { get; init; }
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
public required DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Id of the user that created the entity.
/// </summary>
public required Guid CreatedBy { get; set; }
/// <summary>
/// Gets or sets the optional time and date when the entity was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional Id of the user that updated the entity.
/// </summary>
public Guid? UpdatedBy { get; set; }
}
@@ -0,0 +1,207 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for an album, a release of an artist.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class AlbumEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets the Id of the album.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets or sets the Id of the artist the album belongs to.
/// </summary>
public required Guid ArtistId { get; set; }
/// <summary>
/// Gets or sets the Id of the media library the artist of the album belongs to.
/// </summary>
public required Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the title of the album.
/// </summary>
public required string Title { get; set; }
/// <summary>
/// Gets or sets the original title of the album, if applicable.
/// </summary>
public string? OriginalTitle { get; set; }
/// <summary>
/// Gets or sets the description of the album, if applicable.
/// </summary>
public string? Description { get; set; }
/// <summary>
/// Gets or sets the original release date of the album, if applicable.
/// </summary>
public DateOnly? OriginalReleaseDate { get; set; }
/// <summary>
/// Gets or sets the original release year of the album, if applicable.
/// </summary>
public int? OriginalReleaseYear { get; set; }
/// <summary>
/// Gets or sets the re-release or reissue date of the album, if applicable.
/// </summary>
public DateOnly? ReReleaseDate { get; set; }
/// <summary>
/// Gets or sets the re-release or reissue year of the album, if applicable.
/// </summary>
public int? ReReleaseYear { get; set; }
/// <summary>
/// Gets or sets the country or region of release, if applicable.
/// </summary>
public ReleaseCountry? ReleaseCountry { get; set; }
/// <summary>
/// Gets or sets the release version or edition of the album, if applicable.
/// </summary>
public string? ReleaseVersion { get; set; }
/// <summary>
/// Gets or sets the ISO 639-1 two-letter language code of the album, if applicable.
/// </summary>
public string? LanguageCode { get; set; }
/// <summary>
/// Gets or sets the full name of the language of the album in English, if applicable.
/// </summary>
public string? LanguageName { get; set; }
/// <summary>
/// Gets or sets the native name of the language of the album, if applicable.
/// </summary>
public string? LanguageNativeName { get; set; }
/// <summary>
/// Gets or sets the ISO 639-1 two-letter original language code of the album, if applicable.
/// </summary>
public string? OriginalLanguageCode { get; set; }
/// <summary>
/// Gets or sets the full name of the original language of the album in English, if applicable.
/// </summary>
public string? OriginalLanguageName { get; set; }
/// <summary>
/// Gets or sets the native name of the original language of the album, if applicable.
/// </summary>
public string? OriginalLanguageNativeName { get; set; }
/// <summary>
/// Gets or sets the type of the release, if applicable.
/// </summary>
public MusicReleaseType? ReleaseType { get; set; }
/// <summary>
/// Gets or sets the status of the release, if applicable.
/// </summary>
public MusicReleaseStatus? ReleaseStatus { get; set; }
/// <summary>
/// Gets or sets the number of discs of the release, if applicable.
/// </summary>
public int? TotalDiscs { get; set; }
/// <summary>
/// Gets or sets the number of tracks of the release.
/// </summary>
public int TotalTracks { get; set; }
/// <summary>
/// Gets or sets the physical or digital medium of the album, if applicable.
/// </summary>
public MusicMediaFormat? MediaFormat { get; set; }
/// <summary>
/// Gets or sets the barcode of the album, if applicable.
/// </summary>
public string? Barcode { get; set; }
/// <summary>
/// Gets or sets the catalog number of the album, if applicable.
/// </summary>
public string? CatalogNumber { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the release, if applicable.
/// </summary>
public Guid? MusicBrainzReleaseId { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the release group, if applicable.
/// </summary>
public Guid? MusicBrainzReleaseGroupId { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the release artist, if applicable.
/// </summary>
public Guid? MusicBrainzReleaseArtistId { get; set; }
/// <summary>
/// Gets or sets the artist the album belongs to.
/// </summary>
public ArtistEntity? Artist { get; set; }
/// <summary>
/// Gets or sets the tracks of the album.
/// </summary>
public List<TrackEntity> Tracks { get; set; } = [];
/// <summary>
/// Gets or sets the list of ratings for this album.
/// </summary>
public List<AudioRatingEntity> Ratings { get; set; } = [];
/// <summary>
/// Gets or sets the list of the media contributors of the album.
/// </summary>
public List<AlbumContributorEntity> Contributors { get; set; } = [];
/// <summary>
/// Gets or sets the genres of the album.
/// </summary>
public HashSet<GenreEntity> Genres { get; set; } = [];
/// <summary>
/// Gets or sets the tags of the album.
/// </summary>
public HashSet<TagEntity> Tags { get; set; } = [];
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
public required DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Id of the user that created the entity.
/// </summary>
public required Guid CreatedBy { get; set; }
/// <summary>
/// Gets or sets the optional time and date when the entity was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional Id of the user that updated the entity.
/// </summary>
public required Guid? UpdatedBy { get; set; }
}
@@ -0,0 +1,56 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for the participation of a media contributor in an artist, carrying the role the contributor played in that artist.
/// The role is tracked per participation, so that a single contributor can play multiple roles in the same artist, or different roles in different artists.
/// </summary>
[DebuggerDisplay("ArtistId: {ArtistId} MediaContributorId: {MediaContributorId}")]
public class ArtistContributorEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets the Id of the participation.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets the Id of the artist the contributor participated in.
/// </summary>
public required Guid ArtistId { get; init; }
/// <summary>
/// Gets the Id of the media contributor.
/// </summary>
public required Guid MediaContributorId { get; init; }
/// <summary>
/// Gets the role the contributor played in the artist.
/// </summary>
public required MediaContributorRole Role { get; init; }
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
public required DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Id of the user that created the entity.
/// </summary>
public required Guid CreatedBy { get; set; }
/// <summary>
/// Gets or sets the optional time and date when the entity was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional Id of the user that updated the entity.
/// </summary>
public Guid? UpdatedBy { get; set; }
}
@@ -0,0 +1,71 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for an artist.
/// </summary>
[DebuggerDisplay("Name: {Name}")]
public class ArtistEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets the Id of the artist.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets or sets the Id of the media library this artist belongs to.
/// </summary>
public required Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the name of the artist.
/// </summary>
public required string Name { get; set; }
/// <summary>
/// Gets or sets the website of the artist, if applicable.
/// </summary>
public string? Website { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the artist, if applicable.
/// </summary>
public Guid? MusicBrainzArtistId { get; set; }
/// <summary>
/// Gets or sets the albums of the artist.
/// </summary>
public List<AlbumEntity> Albums { get; set; } = [];
/// <summary>
/// Gets or sets the list of the media contributors that make up the artist.
/// </summary>
public List<ArtistContributorEntity> Contributors { get; set; } = [];
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
public required DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Id of the user that created the entity.
/// </summary>
public required Guid CreatedBy { get; set; }
/// <summary>
/// Gets or sets the optional time and date when the entity was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional Id of the user that updated the entity.
/// </summary>
public required Guid? UpdatedBy { get; set; }
}
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for the rating of an audio media element.
/// </summary>
/// <param name="Value">The rating value of the audio media element.</param>
/// <param name="MaxValue">The maximum possible rating value of the audio media element.</param>
/// <param name="Source">The source of the audio rating (e.g., a specific website or platform).</param>
/// <param name="VoteCount">The number of votes that contributed to the audio rating.</param>
[DebuggerDisplay("{Value}/{MaxValue}")]
public record AudioRatingEntity(
decimal? Value,
decimal? MaxValue,
AudioRatingSource? Source,
int? VoteCount
) : RatingEntity(Value, MaxValue, VoteCount);
@@ -0,0 +1,56 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.MediaContributors;
using System;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for the participation of a media contributor in a track, carrying the role the contributor played in that track.
/// The role is tracked per participation, so that a single contributor can play multiple roles in the same track, or different roles in different tracks.
/// </summary>
[DebuggerDisplay("TrackId: {TrackId} MediaContributorId: {MediaContributorId}")]
public class TrackContributorEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets the Id of the participation.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets the Id of the track the contributor participated in.
/// </summary>
public required Guid TrackId { get; init; }
/// <summary>
/// Gets the Id of the media contributor.
/// </summary>
public required Guid MediaContributorId { get; init; }
/// <summary>
/// Gets the role the contributor played in the track.
/// </summary>
public required MediaContributorRole Role { get; init; }
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
public required DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Id of the user that created the entity.
/// </summary>
public required Guid CreatedBy { get; set; }
/// <summary>
/// Gets or sets the optional time and date when the entity was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional Id of the user that updated the entity.
/// </summary>
public Guid? UpdatedBy { get; set; }
}
@@ -0,0 +1,242 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Common;
using Lumina.Domain.SharedKernel.Common.Enums.AudioLibrary;
using Lumina.Domain.SharedKernel.Common.Enums.Common;
using System;
using System.Collections.Generic;
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for a track, the individual song of an album.
/// </summary>
[DebuggerDisplay("Title: {Title}")]
public class TrackEntity : IStorageEntity, IAuditableEntity
{
/// <summary>
/// Gets the Id of the track.
/// </summary>
public required Guid Id { get; init; }
/// <summary>
/// Gets or sets the Id of the album the track belongs to.
/// </summary>
public required Guid AlbumId { get; set; }
/// <summary>
/// Gets or sets the Id of the media library this track belongs to.
/// </summary>
public required Guid LibraryId { get; set; }
/// <summary>
/// Gets or sets the file system path of the track.
/// </summary>
public required string Path { get; set; }
/// <summary>
/// Gets or sets the title of the track.
/// </summary>
public required string Title { get; set; }
/// <summary>
/// Gets or sets the original title of the track, if applicable.
/// </summary>
public string? OriginalTitle { get; set; }
/// <summary>
/// Gets or sets the description of the track, if applicable.
/// </summary>
public string? Description { get; set; }
/// <summary>
/// Gets or sets the original release date of the track, if applicable.
/// </summary>
public DateOnly? OriginalReleaseDate { get; set; }
/// <summary>
/// Gets or sets the original release year of the track, if applicable.
/// </summary>
public int? OriginalReleaseYear { get; set; }
/// <summary>
/// Gets or sets the re-release or reissue date of the track, if applicable.
/// </summary>
public DateOnly? ReReleaseDate { get; set; }
/// <summary>
/// Gets or sets the re-release or reissue year of the track, if applicable.
/// </summary>
public int? ReReleaseYear { get; set; }
/// <summary>
/// Gets or sets the country or region of release, if applicable.
/// </summary>
public ReleaseCountry? ReleaseCountry { get; set; }
/// <summary>
/// Gets or sets the release version or edition of the track, if applicable.
/// </summary>
public string? ReleaseVersion { get; set; }
/// <summary>
/// Gets or sets the ISO 639-1 two-letter language code of the track, if applicable.
/// </summary>
public string? LanguageCode { get; set; }
/// <summary>
/// Gets or sets the full name of the language of the track in English, if applicable.
/// </summary>
public string? LanguageName { get; set; }
/// <summary>
/// Gets or sets the native name of the language of the track, if applicable.
/// </summary>
public string? LanguageNativeName { get; set; }
/// <summary>
/// Gets or sets the ISO 639-1 two-letter original language code of the track, if applicable.
/// </summary>
public string? OriginalLanguageCode { get; set; }
/// <summary>
/// Gets or sets the full name of the original language of the track in English, if applicable.
/// </summary>
public string? OriginalLanguageName { get; set; }
/// <summary>
/// Gets or sets the native name of the original language of the track, if applicable.
/// </summary>
public string? OriginalLanguageNativeName { get; set; }
/// <summary>
/// Gets or sets the duration of the audio in seconds.
/// </summary>
public int DurationInSeconds { get; set; }
/// <summary>
/// Gets or sets the sample rate of the audio in Hz.
/// </summary>
public int SampleRate { get; set; }
/// <summary>
/// Gets or sets the number of audio channels.
/// </summary>
public int Channels { get; set; }
/// <summary>
/// Gets or sets the bit depth of the audio, if applicable.
/// </summary>
public int? BitDepth { get; set; }
/// <summary>
/// Gets or sets the audio codec used, if applicable.
/// </summary>
public string? AudioCodec { get; set; }
/// <summary>
/// Gets or sets the bitrate of the audio in kbps, if applicable.
/// </summary>
public int? Bitrate { get; set; }
/// <summary>
/// Gets or sets the number of the track on its disc.
/// </summary>
public int TrackNumber { get; set; }
/// <summary>
/// Gets or sets the number of the disc the track belongs to, if applicable.
/// </summary>
public int? DiscNumber { get; set; }
/// <summary>
/// Gets or sets the script used by the language of the track, if applicable.
/// </summary>
public string? Script { get; set; }
/// <summary>
/// Gets or sets the musical key of the track, if applicable.
/// </summary>
public MusicKey? Key { get; set; }
/// <summary>
/// Gets or sets the tempo of the track in beats per minute, if applicable.
/// </summary>
public int? Bpm { get; set; }
/// <summary>
/// Gets or sets the title of the work the track is a recording of, if applicable.
/// </summary>
public string? Work { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the recording, if applicable.
/// </summary>
public Guid? MusicBrainzRecordingId { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the track, if applicable.
/// </summary>
public Guid? MusicBrainzTrackId { get; set; }
/// <summary>
/// Gets or sets the MusicBrainz identifier of the work, if applicable.
/// </summary>
public Guid? MusicBrainzWorkId { get; set; }
/// <summary>
/// Gets or sets the album the track belongs to.
/// </summary>
public AlbumEntity? Album { get; set; }
/// <summary>
/// Gets or sets the list of ratings for this track.
/// </summary>
public List<AudioRatingEntity> Ratings { get; set; } = [];
/// <summary>
/// Gets or sets the list of the media contributors of the track.
/// </summary>
public List<TrackContributorEntity> Contributors { get; set; } = [];
/// <summary>
/// Gets or sets the list of moods of the track.
/// </summary>
public List<TrackMoodEntity> Moods { get; set; } = [];
/// <summary>
/// Gets or sets the list of ISRC (International Standard Recording Code) of the track.
/// </summary>
public List<TrackIsrcEntity> Isrcs { get; set; } = [];
/// <summary>
/// Gets or sets the genres of the track.
/// </summary>
public HashSet<GenreEntity> Genres { get; set; } = [];
/// <summary>
/// Gets or sets the tags of the track.
/// </summary>
public HashSet<TagEntity> Tags { get; set; } = [];
/// <summary>
/// Gets or sets the time and date when the entity was added.
/// </summary>
public required DateTime CreatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the Id of the user that created the entity.
/// </summary>
public required Guid CreatedBy { get; set; }
/// <summary>
/// Gets or sets the optional time and date when the entity was updated.
/// </summary>
public DateTime? UpdatedOnUtc { get; set; }
/// <summary>
/// Gets or sets the optional Id of the user that updated the entity.
/// </summary>
public required Guid? UpdatedBy { get; set; }
}
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for an ISRC (International Standard Recording Code) of a track.
/// </summary>
/// <param name="Value">The value of the ISRC.</param>
[DebuggerDisplay("Value: {Value}")]
public record TrackIsrcEntity(
string Value
);
@@ -0,0 +1,14 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
#endregion
namespace Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
/// <summary>
/// Repository entity for a mood of a track.
/// </summary>
/// <param name="Name">The name of the mood.</param>
[DebuggerDisplay("Name: {Name}")]
public record TrackMoodEntity(
string Name
);
@@ -199,12 +199,12 @@ public class BookEntity : IStorageEntity, IAuditableEntity
/// <summary>
/// Gets or sets the participations of the media contributors in the book, each carrying the role the contributor played.
/// </summary>
public List<BookContributorEntity> BookContributors { get; set; } = [];
public List<BookContributorEntity> Contributors { get; set; } = [];
/// <summary>
/// Gets or sets the pieces of artwork of the book, each tracked independently with its own enrichment state.
/// </summary>
public List<BookArtworkEntity> BookArtwork { get; set; } = [];
public List<BookArtworkEntity> Artwork { get; set; } = [];
/// <summary>
/// Gets or sets the list of ratings for this book.
@@ -10,7 +10,7 @@ using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.Books;
namespace Lumina.Application.Common.DataAccess.Repositories.BookLibrary;
/// <summary>
/// Interface for the repository for books.
@@ -20,7 +20,8 @@ public interface IBookRepository : IRepository<BookEntity>,
IUpdateRepositoryAction<BookEntity>,
IGetByIdRepositoryAction<BookEntity, Guid>,
IGetAllRepositoryAction<BookEntity>,
IGetAllLiteRepositoryAction<BookEntity, BookLiteRow>
IGetAllLiteRepositoryAction<BookEntity, BookLiteRow>,
IDeleteByIdRepositoryAction<Guid>
{
/// <summary>
/// Gets all the books of the media library identified by <paramref name="libraryId"/>.
@@ -113,12 +114,4 @@ public interface IBookRepository : IRepository<BookEntity>,
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> containing either the display names of the authors of the books, keyed by book Id, or an error.</returns>
Task<Result<IReadOnlyDictionary<Guid, string?>>> GetAuthorsDisplayNamesByBookIdsAsync(IReadOnlyCollection<Guid> bookIds, CancellationToken cancellationToken);
/// <summary>
/// Deletes the book identified by <paramref name="bookId"/>.
/// </summary>
/// <param name="bookId">The Id of the book to delete.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
Task<Result<Deleted>> DeleteAsync(Guid bookId, CancellationToken cancellationToken);
}
@@ -0,0 +1,41 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Albums;
using Lumina.Application.Common.DTO.Pagination;
using Lumina.Domain.Common.Primitives;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.MusicLibrary;
/// <summary>
/// Interface for the repository for albums.
/// </summary>
public interface IAlbumRepository : IRepository<AlbumEntity>,
IInsertRepositoryAction<AlbumEntity>,
IUpdateRepositoryAction<AlbumEntity>,
IGetByIdRepositoryAction<AlbumEntity, Guid>,
IDeleteByIdRepositoryAction<Guid>
{
/// <summary>
/// Gets all the albums of the artist identified by <paramref name="artistId"/>.
/// </summary>
/// <param name="artistId">The Id of the artist whose albums are retrieved.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> containing either a collection of <see cref="AlbumEntity"/>, or an error.</returns>
Task<Result<IReadOnlyList<AlbumEntity>>> GetByArtistIdAsync(Guid artistId, CancellationToken cancellationToken);
/// <summary>
/// Gets the lightweight read models of the albums of the artist identified by <paramref name="artistId"/>, projecting only the fields needed to display the albums in a card-based grid or a list.
/// </summary>
/// <param name="artistId">The Id of the artist whose albums are retrieved.</param>
/// <param name="paginationData">The pagination data that includes the current page and the number of items per page to retrieve. If <see langword="null"/>, all matching albums are returned.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> containing either a paginated result of <see cref="AlbumLiteRow"/>, or an error.</returns>
Task<Result<PaginatedResultDto<AlbumLiteRow>>> GetAlbumsLiteByArtistIdAsync(Guid artistId, PaginationDataDto? paginationData, CancellationToken cancellationToken);
}
@@ -0,0 +1,22 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Artists;
using System;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.MusicLibrary;
/// <summary>
/// Interface for the repository for artists.
/// </summary>
public interface IArtistRepository : IRepository<ArtistEntity>,
IInsertRepositoryAction<ArtistEntity>,
IUpdateRepositoryAction<ArtistEntity>,
IGetByIdRepositoryAction<ArtistEntity, Guid>,
IGetAllRepositoryAction<ArtistEntity>,
IGetAllLiteRepositoryAction<ArtistEntity, ArtistLiteRow>,
IDeleteByIdRepositoryAction<Guid>
{
}
@@ -0,0 +1,41 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.MediaLibrary.AudioLibrary.MusicLibrary;
using Lumina.Application.Common.DataAccess.Repositories.Common.Actions;
using Lumina.Application.Common.DataAccess.Repositories.Common.Base;
using Lumina.Application.Common.DTO.MediaLibrary.AudioLibrary.MusicLibrary.Tracks;
using Lumina.Application.Common.DTO.Pagination;
using Lumina.Domain.Common.Primitives;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
#endregion
namespace Lumina.Application.Common.DataAccess.Repositories.MusicLibrary;
/// <summary>
/// Interface for the repository for tracks.
/// </summary>
public interface ITrackRepository : IRepository<TrackEntity>,
IInsertRepositoryAction<TrackEntity>,
IUpdateRepositoryAction<TrackEntity>,
IGetByIdRepositoryAction<TrackEntity, Guid>,
IDeleteByIdRepositoryAction<Guid>
{
/// <summary>
/// Gets all the tracks of the album identified by <paramref name="albumId"/>.
/// </summary>
/// <param name="albumId">The Id of the album whose tracks are retrieved.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> containing either a collection of <see cref="TrackEntity"/>, or an error.</returns>
Task<Result<IReadOnlyList<TrackEntity>>> GetByAlbumIdAsync(Guid albumId, CancellationToken cancellationToken);
/// <summary>
/// Gets the lightweight read models of the tracks of the album identified by <paramref name="albumId"/>, projecting only the fields needed to display the tracks of an album.
/// </summary>
/// <param name="albumId">The Id of the album whose tracks are retrieved.</param>
/// <param name="paginationData">The pagination data that includes the current page and the number of items per page to retrieve. If <see langword="null"/>, all matching tracks are returned.</param>
/// <param name="cancellationToken">Cancellation token that can be used to stop the execution.</param>
/// <returns>An <see cref="Result{TValue}"/> containing either a paginated result of <see cref="TrackLiteRow"/>, or an error.</returns>
Task<Result<PaginatedResultDto<TrackLiteRow>>> GetTracksLiteByAlbumIdAsync(Guid albumId, PaginationDataDto? paginationData, CancellationToken cancellationToken);
}