mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 17:11:10 +00:00
Adds real time media libraries scan progress update via SignalR
This commit is contained in:
1 parent
d70b2dcaa0
commit
e0d61802df
71 files changed
+1292
-131
No files matched your search
+2
-2
@@ -12,13 +12,13 @@ namespace Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.Lib
|
||||
/// Domain event raised when a libary scan has failed.
|
||||
/// </summary>
|
||||
/// <param name="Id">The unique identifier of the domain event.</param>
|
||||
/// <param name="ScanId">The unique identifier of the failed media library scan.</param>
|
||||
/// <param name="LibraryId">The unique identifier of the library whose scan has failed.</param>
|
||||
/// <param name="MediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <param name="OccurredOnUtc">The date and time when the domain event occurred.</param>
|
||||
[DebuggerDisplay("Id: {Id}")]
|
||||
public record LibraryScanFailedDomainEvent(
|
||||
Guid Id,
|
||||
ScanId ScanId,
|
||||
LibraryId LibraryId,
|
||||
MediaLibraryScanCompositeId MediaLibraryScanCompositeId,
|
||||
DateTime OccurredOnUtc
|
||||
) : IDomainEvent;
|
||||
+2
-6
@@ -1,8 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Events;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
@@ -13,13 +11,11 @@ namespace Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.Lib
|
||||
/// Domain event raised when a libary scan is finished.
|
||||
/// </summary>
|
||||
/// <param name="Id">The unique identifier of the domain event.</param>
|
||||
/// <param name="ScanId">The object representing the unique identifier of the media library scan.</param>
|
||||
/// <param name="UserId">The object representing the unique identifier of the user that started the library scan whose progress changes.</param>
|
||||
/// <param name="MediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <param name="OccurredOnUtc">The date and time when the domain event occurred.</param>
|
||||
[DebuggerDisplay("ScanId: {ScanId}; UserId: {UserId}")]
|
||||
public record LibraryScanFinishedDomainEvent(
|
||||
Guid Id,
|
||||
ScanId ScanId,
|
||||
UserId UserId,
|
||||
MediaLibraryScanCompositeId MediaLibraryScanCompositeId,
|
||||
DateTime OccurredOnUtc
|
||||
) : IDomainEvent;
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.Domain.Common.Events;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
@@ -12,15 +12,15 @@ namespace Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.Lib
|
||||
/// Domain event raised when a libary's scan job progress changes.
|
||||
/// </summary>
|
||||
/// <param name="Id">The unique identifier of the domain event.</param>
|
||||
/// <param name="ScanId">The object representing the unique identifier of the media library scan.</param>
|
||||
/// <param name="UserId">The object representing the unique identifier of the user that started the library scan whose progress changes.</param>
|
||||
/// <param name="LibraryId">The object representing the unique identifier of the media library being scanned.</param>
|
||||
/// <param name="MediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <param name="Progress">The object representing the new media library scan job progress.</param>
|
||||
/// <param name="OccurredOnUtc">The date and time when the domain event occurred.</param>
|
||||
[DebuggerDisplay("ScanId: {ScanId}; UserId: {UserId}")]
|
||||
public record LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid Id,
|
||||
ScanId ScanId,
|
||||
UserId UserId,
|
||||
LibraryId LibraryId,
|
||||
MediaLibraryScanCompositeId MediaLibraryScanCompositeId,
|
||||
MediaLibraryScanJobProgress Progress,
|
||||
DateTime OccurredOnUtc
|
||||
) : IDomainEvent;
|
||||
+5
-6
@@ -2,7 +2,6 @@
|
||||
using Lumina.Domain.Common.Events;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
@@ -13,13 +12,13 @@ namespace Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.Lib
|
||||
/// Domain event raised when a libary's scan progress changes.
|
||||
/// </summary>
|
||||
/// <param name="Id">The unique identifier of the domain event.</param>
|
||||
/// <param name="ScanId">The object representing the unique identifier of the media library scan.</param>
|
||||
/// <param name="UserId">The object representing the unique identifier of the user that started the library scan whose progress changes.</param>
|
||||
/// <param name="LibraryId">The object representing the unique identifier of the media library being scanned.</param>
|
||||
/// <param name="MediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <param name="OccurredOnUtc">The date and time when the domain event occurred.</param>
|
||||
[DebuggerDisplay("ScanId: {ScanId}; UserId: {UserId}")]
|
||||
[DebuggerDisplay("ScanId: {MediaLibraryScanCompositeId.ScanId}; UserId: {MediaLibraryScanCompositeId.UserId}")]
|
||||
public record LibraryScanProgressChangedDomainEvent(
|
||||
Guid Id,
|
||||
ScanId ScanId,
|
||||
UserId UserId,
|
||||
LibraryId LibraryId,
|
||||
MediaLibraryScanCompositeId MediaLibraryScanCompositeId,
|
||||
DateTime OccurredOnUtc
|
||||
) : IDomainEvent;
|
||||
+1
-1
@@ -86,7 +86,7 @@ internal class MediaLibraryScanningService : IMediaLibraryScanningService
|
||||
|
||||
// count total jobs in the chain by traversing the job graph
|
||||
int totalJobs = CountTotalJobs(jobs);
|
||||
_mediaLibrariesScanProgressTracker.InitializeScanProgress(MediaLibraryScanCompositeId.Create(scan.Id, scan.UserId), totalJobs);
|
||||
_mediaLibrariesScanProgressTracker.InitializeScanProgress(scan.LibraryId, MediaLibraryScanCompositeId.Create(scan.Id, scan.UserId), totalJobs);
|
||||
|
||||
// enqueue the jobs on the channel from where they will be processed
|
||||
foreach (IMediaLibraryScanJob job in jobs)
|
||||
|
||||
+16
-3
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using ErrorOr;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
#endregion
|
||||
|
||||
@@ -13,25 +14,28 @@ public interface IMediaLibrariesScanProgressTracker
|
||||
/// <summary>
|
||||
/// Initializes the the progress tracking of a media library scan.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The object representing the unique identifier of the media library being scanned.</param>
|
||||
/// <param name="mediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <param name="totalJobs">The total number of jobs that this media library scan contains.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
ErrorOr<Created> InitializeScanProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId, int totalJobs);
|
||||
ErrorOr<Created> InitializeScanProgress(LibraryId libraryId, MediaLibraryScanCompositeId mediaLibraryScanCompositeId, int totalJobs);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the progress tracking of the media library scan by incrementing the number of completed scan jobs.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The object representing the unique identifier of the media library being scanned.</param>
|
||||
/// <param name="mediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
ErrorOr<Updated> UpdateScanProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId);
|
||||
ErrorOr<Updated> UpdateScanProgress(LibraryId libraryId, MediaLibraryScanCompositeId mediaLibraryScanCompositeId);
|
||||
|
||||
/// <summary>
|
||||
/// Updates the progress tracking of the media library scan by incrementing the number of completed items of a scan job.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The object representing the unique identifier of the media library being scanned.</param>
|
||||
/// <param name="mediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <param name="progress">The object representing the progress of the media library scan job.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
ErrorOr<Updated> UpdateScanJobProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId, MediaLibraryScanJobProgress progress);
|
||||
ErrorOr<Updated> UpdateScanJobProgress(LibraryId libraryId, MediaLibraryScanCompositeId mediaLibraryScanCompositeId, MediaLibraryScanJobProgress progress);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the progress of a media library scan.
|
||||
@@ -41,4 +45,13 @@ public interface IMediaLibrariesScanProgressTracker
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a <see cref="MediaLibraryScanProgress"/>, or an error message.
|
||||
/// </returns>
|
||||
ErrorOr<MediaLibraryScanProgress> GetScanProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the progress of a media library scan.
|
||||
/// </summary>
|
||||
/// <param name="mediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a <see cref="MediaLibraryScanProgress"/>, or an error message.
|
||||
/// </returns>
|
||||
ErrorOr<MediaLibraryScanProgress> RemoveScanProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId);
|
||||
}
|
||||
+30
-3
@@ -3,6 +3,7 @@ using ErrorOr;
|
||||
using Lumina.Domain.Common.Enums.MediaLibrary;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using System.Collections.Concurrent;
|
||||
#endregion
|
||||
@@ -19,16 +20,20 @@ internal class MediaLibrariesScanProgressTracker : IMediaLibrariesScanProgressTr
|
||||
/// <summary>
|
||||
/// Initializes the the progress tracking of a media library scan.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The object representing the unique identifier of the media library being scanned.</param>
|
||||
/// <param name="mediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <param name="totalJobs">The total number of jobs that this media library scan contains.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
public ErrorOr<Created> InitializeScanProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId, int totalJobs)
|
||||
public ErrorOr<Created> InitializeScanProgress(LibraryId libraryId, MediaLibraryScanCompositeId mediaLibraryScanCompositeId, int totalJobs)
|
||||
{
|
||||
ErrorOr<MediaLibraryScanJobProgress> createLibraryScanJobProgressResult = MediaLibraryScanJobProgress.Create(0, 0, "Initializing");
|
||||
if (createLibraryScanJobProgressResult.IsError)
|
||||
return createLibraryScanJobProgressResult.Errors;
|
||||
|
||||
ErrorOr<MediaLibraryScanProgress> createScanProgressResult = MediaLibraryScanProgress.Create(
|
||||
mediaLibraryScanCompositeId.ScanId,
|
||||
mediaLibraryScanCompositeId.UserId,
|
||||
libraryId,
|
||||
completedJobs: 0,
|
||||
totalJobs: totalJobs,
|
||||
LibraryScanJobStatus.Pending,
|
||||
@@ -45,13 +50,17 @@ internal class MediaLibrariesScanProgressTracker : IMediaLibrariesScanProgressTr
|
||||
/// <summary>
|
||||
/// Updates the progress tracking of the media library scan by incrementing the number of completed scan jobs.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The object representing the unique identifier of the media library being scanned.</param>
|
||||
/// <param name="mediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
public ErrorOr<Updated> UpdateScanProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId)
|
||||
public ErrorOr<Updated> UpdateScanProgress(LibraryId libraryId, MediaLibraryScanCompositeId mediaLibraryScanCompositeId)
|
||||
{
|
||||
if (_scanProgresses.TryGetValue(mediaLibraryScanCompositeId, out MediaLibraryScanProgress? progress))
|
||||
{
|
||||
ErrorOr<MediaLibraryScanProgress> createScanProgressResult = MediaLibraryScanProgress.Create(
|
||||
mediaLibraryScanCompositeId.ScanId,
|
||||
mediaLibraryScanCompositeId.UserId,
|
||||
libraryId,
|
||||
progress.CompletedJobs + 1,
|
||||
progress.TotalJobs,
|
||||
progress.CompletedJobs + 1 == progress.TotalJobs ? LibraryScanJobStatus.Completed : LibraryScanJobStatus.Running,
|
||||
@@ -68,14 +77,18 @@ internal class MediaLibrariesScanProgressTracker : IMediaLibrariesScanProgressTr
|
||||
/// <summary>
|
||||
/// Updates the progress tracking of the media library scan by incrementing the number of completed items of a scan job.
|
||||
/// </summary>
|
||||
/// <param name="libraryId">The object representing the unique identifier of the media library being scanned.</param>
|
||||
/// <param name="mediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <param name="progress">The object representing the progress of the media library scan job.</param>
|
||||
/// <returns>An <see cref="ErrorOr{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
public ErrorOr<Updated> UpdateScanJobProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId, MediaLibraryScanJobProgress progress)
|
||||
public ErrorOr<Updated> UpdateScanJobProgress(LibraryId libraryId, MediaLibraryScanCompositeId mediaLibraryScanCompositeId, MediaLibraryScanJobProgress progress)
|
||||
{
|
||||
if (_scanProgresses.TryGetValue(mediaLibraryScanCompositeId, out MediaLibraryScanProgress? scanProgress))
|
||||
{
|
||||
ErrorOr<MediaLibraryScanProgress> createScanProgressResult = MediaLibraryScanProgress.Create(
|
||||
mediaLibraryScanCompositeId.ScanId,
|
||||
mediaLibraryScanCompositeId.UserId,
|
||||
libraryId,
|
||||
scanProgress.CompletedJobs,
|
||||
scanProgress.TotalJobs,
|
||||
scanProgress.Status,
|
||||
@@ -103,4 +116,18 @@ internal class MediaLibrariesScanProgressTracker : IMediaLibrariesScanProgressTr
|
||||
return progress;
|
||||
return Errors.LibraryScanning.LibraryScanNotFound;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes the progress of a media library scan.
|
||||
/// </summary>
|
||||
/// <param name="mediaLibraryScanCompositeId">Model for tracking media library scans.</param>
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a <see cref="MediaLibraryScanProgress"/>, or an error message.
|
||||
/// </returns>
|
||||
public ErrorOr<MediaLibraryScanProgress> RemoveScanProgress(MediaLibraryScanCompositeId mediaLibraryScanCompositeId)
|
||||
{
|
||||
if (_scanProgresses.TryRemove(mediaLibraryScanCompositeId, out MediaLibraryScanProgress? progress))
|
||||
return progress;
|
||||
return Errors.LibraryScanning.LibraryScanNotFound;
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -10,7 +10,7 @@ namespace Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.Lib
|
||||
/// <summary>
|
||||
/// Value Object for the composite unique identifier of a media library scan.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("ScanId: {ScanId}; UserId: {UserId}")]
|
||||
[DebuggerDisplay("ScanId: {ScanId.Value}; UserId: {UserId.Value}")]
|
||||
public sealed class MediaLibraryScanCompositeId : ValueObject
|
||||
{
|
||||
/// <summary>
|
||||
@@ -51,4 +51,13 @@ public sealed class MediaLibraryScanCompositeId : ValueObject
|
||||
yield return ScanId;
|
||||
yield return UserId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Customized ToString() method.
|
||||
/// </summary>
|
||||
/// <returns>Custom string value showing relevant data for current class.</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{ScanId}-{UserId}";
|
||||
}
|
||||
}
|
||||
+43
-3
@@ -4,6 +4,8 @@ using Lumina.Domain.Common.Enums.MediaLibrary;
|
||||
using Lumina.Domain.Common.Errors;
|
||||
using Lumina.Domain.Common.Models.Core;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
#endregion
|
||||
@@ -16,6 +18,21 @@ namespace Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.Lib
|
||||
[DebuggerDisplay("CompletedJobs: {CompletedJobs}; TotalJobs: {TotalJobs}; CurrentJobProgress: {CurrentJobProgress}")]
|
||||
public sealed class MediaLibraryScanProgress : ValueObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the object representing the unique identifier of the media library scan.
|
||||
/// </summary>
|
||||
public ScanId ScanId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object representing the unique identifier of the media library that is scanned.
|
||||
/// </summary>
|
||||
public LibraryId LibraryId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the object representing the unique identifier of the user initiating this media library scan.
|
||||
/// </summary>
|
||||
public UserId UserId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of completed jobs of the media library scan job.
|
||||
/// </summary>
|
||||
@@ -44,12 +61,25 @@ public sealed class MediaLibraryScanProgress : ValueObject
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MediaLibraryScanProgress"/> class.
|
||||
/// </summary>
|
||||
/// <param name="scanId">The object representing the unique identifier of the media library scan.</param>
|
||||
/// <param name="userId">The object representing the unique identifier of the user initiating this media library scan.</param>
|
||||
/// <param name="libraryId">The object representing the unique identifier of the media library that is scanned.</param>
|
||||
/// <param name="completedJobs">The number of completed jobs of the media library scan job.</param>
|
||||
/// <param name="totalJobs">The total number of jobs of the media library scan job.</param>
|
||||
/// <param name="status">The status of the media library scan.</param>
|
||||
/// <param name="currentJobProgress">The optional current job progress of the media library scan.</param>
|
||||
private MediaLibraryScanProgress(int completedJobs, int totalJobs, LibraryScanJobStatus status, Optional<MediaLibraryScanJobProgress> currentJobProgress)
|
||||
private MediaLibraryScanProgress(
|
||||
ScanId scanId,
|
||||
UserId userId,
|
||||
LibraryId libraryId,
|
||||
int completedJobs,
|
||||
int totalJobs,
|
||||
LibraryScanJobStatus status,
|
||||
Optional<MediaLibraryScanJobProgress> currentJobProgress)
|
||||
{
|
||||
ScanId = scanId;
|
||||
LibraryId = libraryId;
|
||||
UserId = userId;
|
||||
CompletedJobs = completedJobs;
|
||||
TotalJobs = totalJobs;
|
||||
CurrentJobProgress = currentJobProgress;
|
||||
@@ -59,6 +89,9 @@ public sealed class MediaLibraryScanProgress : ValueObject
|
||||
/// <summary>
|
||||
/// Creates a new instance of the <see cref="MediaLibraryScanProgress"/> class.
|
||||
/// </summary>
|
||||
/// <param name="scanId">The object representing the unique identifier of the media library scan.</param>
|
||||
/// <param name="userId">The object representing the unique identifier of the user initiating this media library scan.</param>
|
||||
/// <param name="libraryId">The object representing the unique identifier of the media library that is scanned.</param>
|
||||
/// <param name="completedJobs">The number of completed jobs of the media library scan job.</param>
|
||||
/// <param name="totalJobs">The total number of jobs of the media library scan job.</param>
|
||||
/// <param name="status">The status of the media library scan.</param>
|
||||
@@ -66,7 +99,14 @@ public sealed class MediaLibraryScanProgress : ValueObject
|
||||
/// <returns>
|
||||
/// An <see cref="ErrorOr{TValue}"/> containing either a successfuly created <see cref="MediaLibraryScanProgress"/>, or an error message.
|
||||
/// </returns>
|
||||
public static ErrorOr<MediaLibraryScanProgress> Create(int completedJobs, int totalJobs, LibraryScanJobStatus status, Optional<MediaLibraryScanJobProgress> currentJobProgress)
|
||||
public static ErrorOr<MediaLibraryScanProgress> Create(
|
||||
ScanId scanId,
|
||||
UserId userId,
|
||||
LibraryId libraryId,
|
||||
int completedJobs,
|
||||
int totalJobs,
|
||||
LibraryScanJobStatus status,
|
||||
Optional<MediaLibraryScanJobProgress> currentJobProgress)
|
||||
{
|
||||
if (totalJobs <= 0)
|
||||
return Errors.LibraryScanning.TotalScanJobsCountMustBePositive;
|
||||
@@ -75,7 +115,7 @@ public sealed class MediaLibraryScanProgress : ValueObject
|
||||
if (completedJobs > totalJobs)
|
||||
return Errors.LibraryScanning.CompletedScanJobsCountCantExceedTotalScanJobsCount;
|
||||
|
||||
return new MediaLibraryScanProgress(completedJobs, totalJobs, status, currentJobProgress);
|
||||
return new MediaLibraryScanProgress(scanId, userId, libraryId, completedJobs, totalJobs, status, currentJobProgress);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
|
||||
Reference in new issue
Block a user