mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 08:11:10 +00:00
Adds dynamic path templates for media libraries, so that the scanner can derive the meaning of each path part
This commit is contained in:
1 parent
62b0e9297a
commit
ca4f308b0a
86 files changed
+7406
-151
No files matched your search
+7
-2
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.AddLibrary;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System.Collections.Generic;
|
||||
@@ -27,6 +28,7 @@ public class AddLibraryCommandFixture
|
||||
/// <param name="canDownloadMetadataFromWeb">Whether the media library should download metadata from the web or not.</param>
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Whether the metadata should be saved in the media directories or not.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during a scan or not.</param>
|
||||
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
/// <returns>The created command.</returns>
|
||||
public AddLibraryCommand Create(
|
||||
string? title = null,
|
||||
@@ -37,7 +39,8 @@ public class AddLibraryCommandFixture
|
||||
bool isLocked = false,
|
||||
bool canDownloadMetadataFromWeb = true,
|
||||
bool shouldSaveMetadataInMediaDirectories = true,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false)
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false,
|
||||
LibraryPathTemplatePartDto[]? pathTemplateParts = null)
|
||||
{
|
||||
return new Faker<AddLibraryCommand>()
|
||||
.CustomInstantiator(f => new AddLibraryCommand(
|
||||
@@ -49,7 +52,8 @@ public class AddLibraryCommandFixture
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
null
|
||||
))
|
||||
.RuleFor(x => x.Title, f => title ?? f.Lorem.Word())
|
||||
.RuleFor(x => x.LibraryType, f => libraryType ?? f.Random.Enum<LibraryType>().ToString())
|
||||
@@ -60,6 +64,7 @@ public class AddLibraryCommandFixture
|
||||
.RuleFor(x => x.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb)
|
||||
.RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories)
|
||||
.RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
|
||||
.RuleFor(x => x.PathTemplateParts, pathTemplateParts)
|
||||
.Generate();
|
||||
}
|
||||
|
||||
|
||||
+7
-2
@@ -1,5 +1,6 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Application.Common.DTO.MediaLibrary.Management;
|
||||
using Lumina.Application.Core.MediaLibrary.Management.Commands.UpdateLibrary;
|
||||
using Lumina.Domain.SharedKernel.Common.Enums.MediaLibrary;
|
||||
using System;
|
||||
@@ -30,6 +31,7 @@ public class UpdateLibraryCommandFixture
|
||||
/// <param name="canDownloadMetadataFromWeb">Whether the media library should download metadata from the web or not.</param>
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Whether the metadata should be saved in the media directories or not.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during a scan or not.</param>
|
||||
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
/// <returns>The created command.</returns>
|
||||
public UpdateLibraryCommand Create(
|
||||
Guid? id = null,
|
||||
@@ -42,7 +44,8 @@ public class UpdateLibraryCommandFixture
|
||||
bool isLocked = false,
|
||||
bool canDownloadMetadataFromWeb = true,
|
||||
bool shouldSaveMetadataInMediaDirectories = true,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false)
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false,
|
||||
LibraryPathTemplatePartDto[]? pathTemplateParts = null)
|
||||
{
|
||||
return new Faker<UpdateLibraryCommand>()
|
||||
.CustomInstantiator(f => new UpdateLibraryCommand(
|
||||
@@ -56,7 +59,8 @@ public class UpdateLibraryCommandFixture
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
false
|
||||
false,
|
||||
null
|
||||
))
|
||||
.RuleFor(x => x.Id, id ?? Guid.NewGuid())
|
||||
.RuleFor(x => x.OwnerId, ownerId ?? Guid.NewGuid())
|
||||
@@ -69,6 +73,7 @@ public class UpdateLibraryCommandFixture
|
||||
.RuleFor(x => x.CanDownloadMetadataFromWeb, canDownloadMetadataFromWeb)
|
||||
.RuleFor(x => x.ShouldSaveMetadataInMediaDirectories, shouldSaveMetadataInMediaDirectories)
|
||||
.RuleFor(x => x.ShouldSkipUnchangedDirectoriesDuringScan, shouldSkipUnchangedDirectoriesDuringScan)
|
||||
.RuleFor(x => x.PathTemplateParts, pathTemplateParts)
|
||||
.Generate();
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -28,6 +28,7 @@ public class AddLibraryRequestFixture
|
||||
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
|
||||
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
/// <returns>The created <see cref="AddLibraryRequest"/>.</returns>
|
||||
public AddLibraryRequest Create(
|
||||
string? title = null,
|
||||
@@ -38,7 +39,8 @@ public class AddLibraryRequestFixture
|
||||
bool? isLocked = null,
|
||||
bool? canDownloadMetadataFromWeb = null,
|
||||
bool? shouldSaveMetadataInMediaDirectories = null,
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null)
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null,
|
||||
LibraryPathTemplatePartRequest[]? pathTemplateParts = null)
|
||||
{
|
||||
return new AddLibraryRequest(
|
||||
title ?? _faker.Commerce.Department(),
|
||||
@@ -49,7 +51,8 @@ public class AddLibraryRequestFixture
|
||||
isLocked ?? _faker.Random.Bool(),
|
||||
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
|
||||
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool()
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
pathTemplateParts
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+5
-2
@@ -31,6 +31,7 @@ public class UpdateLibraryRequestFixture
|
||||
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
|
||||
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
/// <returns>The created <see cref="UpdateLibraryRequest"/>.</returns>
|
||||
public UpdateLibraryRequest Create(
|
||||
Guid? id = null,
|
||||
@@ -43,7 +44,8 @@ public class UpdateLibraryRequestFixture
|
||||
bool? isLocked = null,
|
||||
bool? canDownloadMetadataFromWeb = null,
|
||||
bool? shouldSaveMetadataInMediaDirectories = null,
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null)
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null,
|
||||
LibraryPathTemplatePartRequest[]? pathTemplateParts = null)
|
||||
{
|
||||
return new UpdateLibraryRequest(
|
||||
id ?? _faker.Random.Guid(),
|
||||
@@ -56,7 +58,8 @@ public class UpdateLibraryRequestFixture
|
||||
isLocked ?? _faker.Random.Bool(),
|
||||
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
|
||||
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool()
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
pathTemplateParts
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
+3
@@ -32,6 +32,7 @@ public class LibraryResponseFixture
|
||||
/// <param name="canDownloadMetadataFromWeb">Optional. Whether metadata should be downloaded from the web.</param>
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Optional. Whether metadata should be saved in the media directories.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Optional. Whether unchanged directories should be skipped during scan.</param>
|
||||
/// <param name="pathTemplateParts">Optional. The ordered parts of the path template of the media library.</param>
|
||||
/// <param name="createdOnUtc">Optional. The date and time when the library was created.</param>
|
||||
/// <param name="updatedOnUtc">Optional. The date and time when the library was updated.</param>
|
||||
/// <returns>The created <see cref="LibraryResponse"/>.</returns>
|
||||
@@ -47,6 +48,7 @@ public class LibraryResponseFixture
|
||||
bool? canDownloadMetadataFromWeb = null,
|
||||
bool? shouldSaveMetadataInMediaDirectories = null,
|
||||
bool? shouldSkipUnchangedDirectoriesDuringScan = null,
|
||||
List<LibraryPathTemplatePartResponse>? pathTemplateParts = null,
|
||||
DateTime? createdOnUtc = null,
|
||||
DateTime? updatedOnUtc = null)
|
||||
{
|
||||
@@ -62,6 +64,7 @@ public class LibraryResponseFixture
|
||||
canDownloadMetadataFromWeb ?? _faker.Random.Bool(),
|
||||
shouldSaveMetadataInMediaDirectories ?? _faker.Random.Bool(),
|
||||
shouldSkipUnchangedDirectoriesDuringScan ?? _faker.Random.Bool(),
|
||||
pathTemplateParts ?? [],
|
||||
createdOnUtc ?? _faker.Date.Past().ToUniversalTime(),
|
||||
updatedOnUtc
|
||||
);
|
||||
|
||||
+5
@@ -1,6 +1,7 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using Lumina.Domain.Common.Primitives;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryAggregate;
|
||||
using Lumina.Domain.Core.BoundedContexts.LibraryManagementBoundedContext.LibraryScanAggregate.ValueObjects;
|
||||
using Lumina.Domain.Core.BoundedContexts.UserManagementBoundedContext.UserAggregate.ValueObjects;
|
||||
@@ -42,6 +43,7 @@ public class LibraryFixture
|
||||
/// <param name="shouldSaveMetadataInMediaDirectories">Whether metadata should be saved in the media directories.</param>
|
||||
/// <param name="shouldSkipUnchangedDirectoriesDuringScan">Whether unchanged directories should be skipped during scan.</param>
|
||||
/// <param name="scanIds">Optional. The scan Ids associated with the library.</param>
|
||||
/// <param name="pathTemplate">Optional. The path template of the library.</param>
|
||||
/// <param name="includeCoverImage">Whether the cover image should be included, or left unset, meaning the library has no cover.</param>
|
||||
/// <returns>The created <see cref="Library"/>.</returns>
|
||||
public Library Create(
|
||||
@@ -57,6 +59,7 @@ public class LibraryFixture
|
||||
bool shouldSaveMetadataInMediaDirectories = false,
|
||||
bool shouldSkipUnchangedDirectoriesDuringScan = false,
|
||||
IEnumerable<Guid>? scanIds = null,
|
||||
LibraryPathTemplate? pathTemplate = null,
|
||||
bool includeCoverImage = true)
|
||||
{
|
||||
List<string> validPaths =
|
||||
@@ -83,6 +86,7 @@ public class LibraryFixture
|
||||
canDownloadMetadataFromWeb,
|
||||
shouldSaveMetadataInMediaDirectories,
|
||||
shouldSkipUnchangedDirectoriesDuringScan,
|
||||
pathTemplate ?? LibraryPathTemplate.Empty(),
|
||||
resolvedScanIds
|
||||
) :
|
||||
Library.Create(
|
||||
@@ -97,6 +101,7 @@ public class LibraryFixture
|
||||
canDownloadMetadataFromWeb,
|
||||
shouldSaveMetadataInMediaDirectories,
|
||||
shouldSkipUnchangedDirectoriesDuringScan,
|
||||
pathTemplate ?? LibraryPathTemplate.Empty(),
|
||||
resolvedScanIds
|
||||
);
|
||||
|
||||
|
||||
Reference in new issue
Block a user