mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-02 04:01:10 +00:00
Migrates persisted identifiers to GUID version 7.
This commit is contained in:
1 parent
fb92a38a7b
commit
8eba545b2b
80 files changed
+305
-129
No files matched your search
+1
-1
@@ -66,7 +66,7 @@ public static class AlbumMapping
|
||||
MusicBrainzReleaseArtistId = domainEntity.MusicBrainzReleaseArtistId.HasValue ? domainEntity.MusicBrainzReleaseArtistId.Value.Value : null,
|
||||
Contributors = [.. domainEntity.Contributors.Select(contributor => new AlbumContributorEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
AlbumId = domainEntity.Id.Value,
|
||||
MediaContributorId = contributor.ContributorId.Value,
|
||||
Role = contributor.Role,
|
||||
|
||||
+1
-1
@@ -48,7 +48,7 @@ public static class ArtistMapping
|
||||
Ratings = [.. domainEntity.Ratings.ToRepositoryEntities()],
|
||||
Contributors = [.. domainEntity.Contributors.Select(contributor => new ArtistContributorEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
ArtistId = domainEntity.Id.Value,
|
||||
MediaContributorId = contributor.ContributorId.Value,
|
||||
Role = contributor.Role,
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public static class TrackMapping
|
||||
MusicBrainzWorkId = domainEntity.Work.HasValue ? domainEntity.Work.Value.MusicBrainzWorkId.Value : null,
|
||||
Contributors = [.. domainEntity.Contributors.Select(contributor => new TrackContributorEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
TrackId = domainEntity.Id.Value,
|
||||
MediaContributorId = contributor.ContributorId.Value,
|
||||
Role = contributor.Role,
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ public static class BookMapping
|
||||
ISBNs = [.. domainEntity.ISBNs.ToRepositoryEntities()],
|
||||
Contributors = [.. domainEntity.Contributors.Select(contributor => new BookContributorEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
BookId = domainEntity.Id.Value,
|
||||
MediaContributorId = contributor.ContributorId.Value,
|
||||
Role = contributor.Role,
|
||||
@@ -115,6 +115,6 @@ public static class BookMapping
|
||||
entity.BarnesAndNobleId = domainEntity.BarnesAndNobleId.HasValue ? domainEntity.BarnesAndNobleId.Value : null;
|
||||
entity.AppleBooksId = domainEntity.AppleBooksId.HasValue ? domainEntity.AppleBooksId.Value : null;
|
||||
entity.UpdatedOnUtc = DateTime.UtcNow;
|
||||
entity.UpdatedBy = Guid.NewGuid();
|
||||
entity.UpdatedBy = Guid.CreateVersion7();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -29,7 +29,7 @@ public static class UpdateBookCoverCommandMapping
|
||||
{
|
||||
return new BookArtworkEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
BookId = bookId,
|
||||
ArtworkType = ArtworkType.Cover,
|
||||
Ordinal = 0,
|
||||
|
||||
+2
-2
@@ -97,7 +97,7 @@ public class SetupApplicationCommandHandler : ICommandHandler<SetupApplicationCo
|
||||
return Errors.Authorization.AdminAccountAlreadyCreated;
|
||||
// No users are present, register the admin one.
|
||||
string? totpSecret = null;
|
||||
Guid id = Guid.NewGuid();
|
||||
Guid id = Guid.CreateVersion7();
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = id,
|
||||
@@ -158,7 +158,7 @@ public class SetupApplicationCommandHandler : ICommandHandler<SetupApplicationCo
|
||||
return getScheduledJobsResult.Errors;
|
||||
foreach (ScheduledJobEntity scheduledJob in getScheduledJobsResult.Value.Data)
|
||||
if (scheduledJob.Status == ScheduledJobStatus.Active)
|
||||
_domainEventsQueue.Enqueue(new ScheduledJobCycleStartedDomainEvent(Guid.NewGuid(), ScheduledJobId.Create(scheduledJob.Id), DateTime.UtcNow));
|
||||
_domainEventsQueue.Enqueue(new ScheduledJobCycleStartedDomainEvent(Guid.CreateVersion7(), ScheduledJobId.Create(scheduledJob.Id), DateTime.UtcNow));
|
||||
|
||||
// TODO: insert the default admin profile preferences when they are implemented.
|
||||
// If 2FA was enabled during registration, the TOTP secret needs to be delivered to the client unhashed, so it can be displayed.
|
||||
|
||||
+1
-1
@@ -101,7 +101,7 @@ public class AddPlaylistEntryCommandHandler : ICommandHandler<AddPlaylistEntryCo
|
||||
if (!Playlist.CanContain(getPlaylistResult.Value.Type, PlaylistMediaItemType.MusicTrack))
|
||||
return DomainErrors.Playlists.PlaylistDoesNotAcceptMediaItems;
|
||||
|
||||
Guid entryId = Guid.NewGuid();
|
||||
Guid entryId = Guid.CreateVersion7();
|
||||
DateTime updatedOnUtc = DateTime.UtcNow;
|
||||
Result<PlaylistBulkAddResultDto> addEntryResult = await _unitOfWork.PlaylistRepository
|
||||
.AddEntriesAsync(playlistId, userId, [trackId], PlaylistMediaItemType.MusicTrack, [entryId], updatedOnUtc, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
+1
-1
@@ -67,7 +67,7 @@ public class UpdateSchedulerDisplayPreferencesCommandHandler : ICommandHandler<U
|
||||
// Upsert the display preferences of the scheduler page of the current user.
|
||||
SchedulerDisplayPreferencesEntity displayPreferences = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
UserId = userId,
|
||||
JobTypeFilter = command.JobTypeFilter,
|
||||
DisplayTimeSpan = command.DisplayTimeSpan,
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ public class InstallThemeCommandHandler : ICommandHandler<InstallThemeCommand, R
|
||||
{
|
||||
themeEntity = new ThemeEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
ThemeId = manifest.Id,
|
||||
Name = manifest.Name,
|
||||
Description = manifest.Description,
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class RegisterUserCommandHandler : ICommandHandler<RegisterUserCommand, R
|
||||
|
||||
// Build the account, hashing the password and URI escaping it the same way as the stored form.
|
||||
string? totpSecret = null;
|
||||
Guid id = Guid.NewGuid();
|
||||
Guid id = Guid.CreateVersion7();
|
||||
UserEntity user = new()
|
||||
{
|
||||
Id = id,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
using Microsoft.EntityFrameworkCore.ValueGeneration;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.DataAccess.Common.ValueGeneration;
|
||||
|
||||
/// <summary>
|
||||
/// Generates time ordered version 7 GUIDs for identifier properties whose values are assigned by the persistence layer.
|
||||
/// </summary>
|
||||
public sealed class GuidV7ValueGenerator : ValueGenerator<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the generated values are temporary.
|
||||
/// </summary>
|
||||
/// <remarks>The generated identifiers are stored permanently, so they are not temporary values.</remarks>
|
||||
public override bool GeneratesTemporaryValues => false;
|
||||
|
||||
/// <summary>
|
||||
/// Generates the next time ordered identifier.
|
||||
/// </summary>
|
||||
/// <param name="entry">The tracked entity entry that owns the property.</param>
|
||||
/// <returns>A new version 7 GUID.</returns>
|
||||
public override Guid Next(EntityEntry entry)
|
||||
{
|
||||
return Guid.CreateVersion7();
|
||||
}
|
||||
}
|
||||
@@ -105,6 +105,8 @@ internal sealed class LibraryScanSnapshotRepository : ILibraryScanSnapshotReposi
|
||||
|
||||
// The Id of the inserted rows is generated in SQL as a random 16 byte value formatted as upper case hex (hex(randomblob(16))), which the storage layer parses as a Guid;
|
||||
// generating the Ids in code would defeat the purpose of these single statement bulk inserts.
|
||||
// These Ids are random version 4 values rather than the version 7 values used elsewhere, because SQLite cannot produce a version 7 GUID
|
||||
// inside this statement. See docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0020.md for details.
|
||||
|
||||
// Add an audit entry for every media library scan snapshot item that is no longer present in the current scan, meaning it was deleted from the storage medium.
|
||||
const string AUDIT_DELETED_SQL = """
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ internal sealed class MediaContributorRepository : IMediaContributorRepository
|
||||
|
||||
MediaContributorEntity contributor = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
DisplayName = displayName,
|
||||
LegalName = legalName,
|
||||
CreatedOnUtc = DateTime.UtcNow,
|
||||
|
||||
@@ -167,7 +167,7 @@ internal sealed class MusicArtworkRepository : IMusicArtworkRepository
|
||||
{
|
||||
_luminaDbContext.MusicArtwork.Add(new MusicArtworkEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
OwnerType = ownerType,
|
||||
OwnerId = ownerId,
|
||||
ArtworkType = ArtworkType.Cover,
|
||||
|
||||
@@ -517,7 +517,7 @@ internal sealed class PlaylistRepository : IPlaylistRepository
|
||||
if (index > 0)
|
||||
insertSql.Append(", ");
|
||||
insertSql.Append($"(@Id{index}, @PlaylistId{index}, @MediaItemId{index}, @mediaItemType, @Position{index}, @createdOnUtc, @createdBy)");
|
||||
Guid entryId = entryIds is null ? Guid.NewGuid() : entryIds[offset + index];
|
||||
Guid entryId = entryIds is null ? Guid.CreateVersion7() : entryIds[offset + index];
|
||||
parameters.Add($"Id{index}", ToStorageId(entryId));
|
||||
parameters.Add($"PlaylistId{index}", playlistIdText);
|
||||
parameters.Add($"MediaItemId{index}", ToStorageId(mediaItemIds[offset + index]));
|
||||
@@ -562,6 +562,8 @@ internal sealed class PlaylistRepository : IPlaylistRepository
|
||||
{
|
||||
// The entry Ids are generated by SQLite in the same upper case, hyphenated TEXT form the Entity Framework provider stores. Generating
|
||||
// them inside the statement is what lets the scope stay a single insert instead of being materialized in C# just to assign Ids.
|
||||
// They are random version 4 values rather than the version 7 values used elsewhere, because SQLite cannot produce a version 7 GUID
|
||||
// inside this statement. See docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0020.md for details.
|
||||
// The positions are computed by the same ordering the artist and album pages use, so the playlist receives catalogue order directly.
|
||||
// ROW_NUMBER() produces the dense rank, and multiplying it by POSITION_STEP keeps the stored keys sparse.
|
||||
StringBuilder insertSql = new("""
|
||||
|
||||
@@ -229,7 +229,7 @@ public class DataSeedService : IDataSeedService
|
||||
{
|
||||
return new ScheduledJobEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
Name = name,
|
||||
TaskType = taskType,
|
||||
ScheduleType = scheduleType,
|
||||
|
||||
@@ -11,7 +11,10 @@ using Lumina.Application.Common.DataAccess.Entities.Plugins;
|
||||
using Lumina.Application.Common.DataAccess.Entities.Scheduling;
|
||||
using Lumina.Application.Common.DataAccess.Entities.Themes;
|
||||
using Lumina.Application.Common.DataAccess.Entities.UsersManagement;
|
||||
using Lumina.DataAccess.Common.ValueGeneration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using System;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.DataAccess.Core.UoW;
|
||||
@@ -210,6 +213,14 @@ public class LuminaDbContext : DbContext
|
||||
// Find all the entity configurations in the assembly and apply them.
|
||||
modelBuilder.ApplyConfigurationsFromAssembly(typeof(LuminaDbContext).Assembly);
|
||||
|
||||
// The relational provider seeds its Guid value generators from Guid.NewGuid, so replace them with a time ordered generator for every
|
||||
// identifier that the persistence layer assigns itself. This covers real keys, such as PermissionEntity.Id, and the shadow keys of
|
||||
// owned collections, such as AlbumReleaseTypes.Id.
|
||||
foreach (IMutableEntityType entityType in modelBuilder.Model.GetEntityTypes())
|
||||
foreach (IMutableProperty property in entityType.GetProperties())
|
||||
if (property.ClrType == typeof(Guid) && property.ValueGenerated == ValueGenerated.OnAdd)
|
||||
property.SetValueGeneratorFactory((generatedProperty, declaringType) => new GuidV7ValueGenerator());
|
||||
|
||||
base.OnModelCreating(modelBuilder);
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class LibraryId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="LibraryId"/> instance.</returns>
|
||||
public static LibraryId CreateUnique()
|
||||
{
|
||||
return new LibraryId(Guid.NewGuid());
|
||||
return new LibraryId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class MediaContributorId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="MediaContributorId"/> instance.</returns>
|
||||
public static MediaContributorId CreateUnique()
|
||||
{
|
||||
return new MediaContributorId(Guid.NewGuid());
|
||||
return new MediaContributorId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class AlbumId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="AlbumId"/> instance.</returns>
|
||||
public static AlbumId CreateUnique()
|
||||
{
|
||||
return new AlbumId(Guid.NewGuid());
|
||||
return new AlbumId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class ArtistId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="ArtistId"/> instance.</returns>
|
||||
public static ArtistId CreateUnique()
|
||||
{
|
||||
return new ArtistId(Guid.NewGuid());
|
||||
return new ArtistId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class TrackId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="TrackId"/> instance.</returns>
|
||||
public static TrackId CreateUnique()
|
||||
{
|
||||
return new TrackId(Guid.NewGuid());
|
||||
return new TrackId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class MediaItemId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="MediaItemId"/> instance.</returns>
|
||||
public static MediaItemId CreateUnique()
|
||||
{
|
||||
return new MediaItemId(Guid.NewGuid());
|
||||
return new MediaItemId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class UserId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="UserId"/> instance.</returns>
|
||||
public static UserId CreateUnique()
|
||||
{
|
||||
return new UserId(Guid.NewGuid());
|
||||
return new UserId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ public sealed class Favorite : AggregateRoot<FavoriteId>
|
||||
Optional<DateTime>.None());
|
||||
|
||||
favorite._domainEvents.Add(new FavoriteAddedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
favorite.Id,
|
||||
userId,
|
||||
mediaItemId,
|
||||
@@ -135,7 +135,7 @@ public sealed class Favorite : AggregateRoot<FavoriteId>
|
||||
_domainEvents.Clear();
|
||||
IsRemoved = true;
|
||||
_domainEvents.Add(new FavoriteRemovedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
Id,
|
||||
UserId,
|
||||
MediaItemId,
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class FavoriteId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="FavoriteId"/> instance.</returns>
|
||||
public static FavoriteId CreateUnique()
|
||||
{
|
||||
return new FavoriteId(Guid.NewGuid());
|
||||
return new FavoriteId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+2
-2
@@ -289,7 +289,7 @@ public class Library : AggregateRoot<LibraryId>
|
||||
/// </summary>
|
||||
public void Save()
|
||||
{
|
||||
_domainEvents.Add(new LibrarySavedDomainEvent(Guid.NewGuid(), this, DateTime.UtcNow));
|
||||
_domainEvents.Add(new LibrarySavedDomainEvent(Guid.CreateVersion7(), this, DateTime.UtcNow));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -312,7 +312,7 @@ public class Library : AggregateRoot<LibraryId>
|
||||
|
||||
// Only add the delete event if it has not been added already.
|
||||
if (!_domainEvents.Any(domainEvent => domainEvent is LibraryDeletedDomainEvent))
|
||||
_domainEvents.Add(new LibraryDeletedDomainEvent(Guid.NewGuid(), this, DateTime.UtcNow));
|
||||
_domainEvents.Add(new LibraryDeletedDomainEvent(Guid.CreateVersion7(), this, DateTime.UtcNow));
|
||||
|
||||
// TODO: perhaps trigger events for removing content related to the removed library (media metadata, etc.).
|
||||
return Result.Deleted;
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class LibraryId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="LibraryId"/> instance.</returns>
|
||||
public static LibraryId CreateUnique()
|
||||
{
|
||||
return new LibraryId(Guid.NewGuid());
|
||||
return new LibraryId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+3
-3
@@ -94,7 +94,7 @@ public class LibraryScan : AggregateRoot<ScanId>
|
||||
if (_pastScans.Any(libraryScan => libraryScan.Status == LibraryScanJobStatus.Running || libraryScan.Status == LibraryScanJobStatus.Pending))
|
||||
return Errors.LibraryScanning.LibraryAlreadyBeingScanned;
|
||||
|
||||
_domainEvents.Add(new LibraryScanQueuedDomainEvent(Guid.NewGuid(), Id, UserId, LibraryId, DateTime.UtcNow));
|
||||
_domainEvents.Add(new LibraryScanQueuedDomainEvent(Guid.CreateVersion7(), Id, UserId, LibraryId, DateTime.UtcNow));
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@@ -114,7 +114,7 @@ public class LibraryScan : AggregateRoot<ScanId>
|
||||
if (_pastScans.Any(libraryScan => libraryScan.Status == LibraryScanJobStatus.Running || libraryScan.Status == LibraryScanJobStatus.Pending))
|
||||
return Errors.LibraryScanning.LibraryAlreadyBeingScanned;
|
||||
|
||||
_domainEvents.Add(new LibraryScanStartedDomainEvent(Guid.NewGuid(), this, DateTime.UtcNow));
|
||||
_domainEvents.Add(new LibraryScanStartedDomainEvent(Guid.CreateVersion7(), this, DateTime.UtcNow));
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class LibraryScan : AggregateRoot<ScanId>
|
||||
else
|
||||
return Errors.LibraryScanning.CanOnlyCancelPendingOrRunningScans;
|
||||
|
||||
_domainEvents.Add(new LibraryScanCancelledDomainEvent(Guid.NewGuid(), Id, LibraryId, DateTime.UtcNow));
|
||||
_domainEvents.Add(new LibraryScanCancelledDomainEvent(Guid.CreateVersion7(), Id, LibraryId, DateTime.UtcNow));
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class ScanId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="ScanId"/> instance.</returns>
|
||||
public static ScanId CreateUnique()
|
||||
{
|
||||
return new ScanId(Guid.NewGuid());
|
||||
return new ScanId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class LibraryId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="LibraryId"/> instance.</returns>
|
||||
public static LibraryId CreateUnique()
|
||||
{
|
||||
return new LibraryId(Guid.NewGuid());
|
||||
return new LibraryId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class MediaItemId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="MediaItemId"/> instance.</returns>
|
||||
public static MediaItemId CreateUnique()
|
||||
{
|
||||
return new MediaItemId(Guid.NewGuid());
|
||||
return new MediaItemId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class UserId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="UserId"/> instance.</returns>
|
||||
public static UserId CreateUnique()
|
||||
{
|
||||
return new UserId(Guid.NewGuid());
|
||||
return new UserId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+6
-6
@@ -171,7 +171,7 @@ public sealed class MediaConsumptionRecord : AggregateRoot<MediaConsumptionRecor
|
||||
0);
|
||||
|
||||
record._domainEvents.Add(new MediaConsumptionStartedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
record.Id,
|
||||
userId,
|
||||
libraryId,
|
||||
@@ -216,7 +216,7 @@ public sealed class MediaConsumptionRecord : AggregateRoot<MediaConsumptionRecor
|
||||
0);
|
||||
|
||||
record._domainEvents.Add(new MediaConsumptionStartedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
record.Id,
|
||||
userId,
|
||||
libraryId,
|
||||
@@ -224,7 +224,7 @@ public sealed class MediaConsumptionRecord : AggregateRoot<MediaConsumptionRecor
|
||||
mediaKind,
|
||||
occurredOnUtc));
|
||||
record._domainEvents.Add(new MediaConsumptionCompletedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
record.Id,
|
||||
userId,
|
||||
libraryId,
|
||||
@@ -341,7 +341,7 @@ public sealed class MediaConsumptionRecord : AggregateRoot<MediaConsumptionRecor
|
||||
LastActivityOnUtc = occurredOnUtc;
|
||||
UpdatedOnUtc = Optional<DateTime>.Some(occurredOnUtc);
|
||||
_domainEvents.Add(new MediaConsumptionProgressedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
Id,
|
||||
UserId,
|
||||
LibraryId,
|
||||
@@ -393,7 +393,7 @@ public sealed class MediaConsumptionRecord : AggregateRoot<MediaConsumptionRecor
|
||||
LastActivityOnUtc = occurredOnUtc;
|
||||
UpdatedOnUtc = Optional<DateTime>.Some(occurredOnUtc);
|
||||
_domainEvents.Add(new MediaConsumptionCompletedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
Id,
|
||||
UserId,
|
||||
LibraryId,
|
||||
@@ -445,7 +445,7 @@ public sealed class MediaConsumptionRecord : AggregateRoot<MediaConsumptionRecor
|
||||
LastActivityOnUtc = occurredOnUtc;
|
||||
UpdatedOnUtc = Optional<DateTime>.Some(occurredOnUtc);
|
||||
_domainEvents.Add(new MediaConsumptionStoppedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
Id,
|
||||
UserId,
|
||||
LibraryId,
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class MediaConsumptionRecordId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="MediaConsumptionRecordId"/> instance.</returns>
|
||||
public static MediaConsumptionRecordId CreateUnique()
|
||||
{
|
||||
return new MediaConsumptionRecordId(Guid.NewGuid());
|
||||
return new MediaConsumptionRecordId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class MediaResumePointId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="MediaResumePointId"/> instance.</returns>
|
||||
public static MediaResumePointId CreateUnique()
|
||||
{
|
||||
return new MediaResumePointId(Guid.NewGuid());
|
||||
return new MediaResumePointId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public sealed class MediaContributorId : EntityId<Guid>
|
||||
public static MediaContributorId CreateUnique()
|
||||
{
|
||||
// TODO: enforce invariants.
|
||||
return new MediaContributorId(Guid.NewGuid());
|
||||
return new MediaContributorId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ public sealed class MediaItemId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="MediaItemId"/> instance.</returns>
|
||||
public static MediaItemId CreateUnique()
|
||||
{
|
||||
return new MediaItemId(Guid.NewGuid());
|
||||
return new MediaItemId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class UserId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="UserId"/> instance.</returns>
|
||||
public static UserId CreateUnique()
|
||||
{
|
||||
return new UserId(Guid.NewGuid());
|
||||
return new UserId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+3
-3
@@ -108,7 +108,7 @@ public sealed class Playlist : AggregateRoot<PlaylistId>
|
||||
Optional<DateTime>.None());
|
||||
|
||||
playlist._domainEvents.Add(new PlaylistCreatedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
playlist.Id,
|
||||
userId,
|
||||
name,
|
||||
@@ -168,7 +168,7 @@ public sealed class Playlist : AggregateRoot<PlaylistId>
|
||||
Description = description;
|
||||
DateTime occurredOnUtc = DateTime.UtcNow;
|
||||
_domainEvents.Add(new PlaylistDetailsUpdatedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
Id,
|
||||
UserId,
|
||||
name,
|
||||
@@ -189,7 +189,7 @@ public sealed class Playlist : AggregateRoot<PlaylistId>
|
||||
_domainEvents.Clear();
|
||||
IsDeleted = true;
|
||||
_domainEvents.Add(new PlaylistDeletedDomainEvent(
|
||||
Guid.NewGuid(),
|
||||
Guid.CreateVersion7(),
|
||||
Id,
|
||||
UserId,
|
||||
DateTime.UtcNow));
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class PlaylistEntryId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="PlaylistEntryId"/> instance.</returns>
|
||||
public static PlaylistEntryId CreateUnique()
|
||||
{
|
||||
return new PlaylistEntryId(Guid.NewGuid());
|
||||
return new PlaylistEntryId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class PlaylistId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="PlaylistId"/> instance.</returns>
|
||||
public static PlaylistId CreateUnique()
|
||||
{
|
||||
return new PlaylistId(Guid.NewGuid());
|
||||
return new PlaylistId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class UserId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="UserId"/> instance.</returns>
|
||||
public static UserId CreateUnique()
|
||||
{
|
||||
return new UserId(Guid.NewGuid());
|
||||
return new UserId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+9
-9
@@ -125,7 +125,7 @@ public class ScheduledJob : AggregateRoot<ScheduledJobId>
|
||||
{
|
||||
if (Status != ScheduledJobStatus.Added)
|
||||
return Errors.Scheduling.ScheduledJobCycleAlreadyStarted;
|
||||
_domainEvents.Add(new ScheduledJobAddedDomainEvent(Guid.NewGuid(), Id, DateTime.UtcNow));
|
||||
_domainEvents.Add(new ScheduledJobAddedDomainEvent(Guid.CreateVersion7(), Id, DateTime.UtcNow));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class ScheduledJob : AggregateRoot<ScheduledJobId>
|
||||
return Errors.Scheduling.ScheduledJobCycleAlreadyStarted;
|
||||
|
||||
Status = ScheduledJobStatus.Active;
|
||||
_domainEvents.Add(new ScheduledJobCycleStartedDomainEvent(Guid.NewGuid(), Id, DateTime.UtcNow));
|
||||
_domainEvents.Add(new ScheduledJobCycleStartedDomainEvent(Guid.CreateVersion7(), Id, DateTime.UtcNow));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@@ -159,10 +159,10 @@ public class ScheduledJob : AggregateRoot<ScheduledJobId>
|
||||
if (previousStatus == ScheduledJobStatus.Running)
|
||||
{
|
||||
LastCompletedOnUtc = Optional<DateTime>.Some(DateTime.UtcNow);
|
||||
_domainEvents.Add(new ScheduledJobExecutionStoppedDomainEvent(Guid.NewGuid(), Id, DateTime.UtcNow));
|
||||
_domainEvents.Add(new ScheduledJobExecutionStoppedDomainEvent(Guid.CreateVersion7(), Id, DateTime.UtcNow));
|
||||
}
|
||||
else
|
||||
_domainEvents.Add(new ScheduledJobCycleStoppedDomainEvent(Guid.NewGuid(), Id, DateTime.UtcNow));
|
||||
_domainEvents.Add(new ScheduledJobCycleStoppedDomainEvent(Guid.CreateVersion7(), Id, DateTime.UtcNow));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class ScheduledJob : AggregateRoot<ScheduledJobId>
|
||||
{
|
||||
if (Status == ScheduledJobStatus.Running)
|
||||
return Errors.Scheduling.ScheduledJobAlreadyRunning;
|
||||
_domainEvents.Add(new ScheduledJobFiredDomainEvent(Guid.NewGuid(), Id, DateTime.UtcNow));
|
||||
_domainEvents.Add(new ScheduledJobFiredDomainEvent(Guid.CreateVersion7(), Id, DateTime.UtcNow));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@@ -184,7 +184,7 @@ public class ScheduledJob : AggregateRoot<ScheduledJobId>
|
||||
/// <returns>An <see cref="Result{TValue}"/> representing either a successful operation, or an error.</returns>
|
||||
public Result<Success> Remove()
|
||||
{
|
||||
_domainEvents.Add(new ScheduledJobRemovedDomainEvent(Guid.NewGuid(), Id, DateTime.UtcNow));
|
||||
_domainEvents.Add(new ScheduledJobRemovedDomainEvent(Guid.CreateVersion7(), Id, DateTime.UtcNow));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@@ -198,11 +198,11 @@ public class ScheduledJob : AggregateRoot<ScheduledJobId>
|
||||
if (Status == ScheduledJobStatus.Running)
|
||||
return Errors.Scheduling.ScheduledJobAlreadyRunning;
|
||||
|
||||
Guid runId = Guid.NewGuid();
|
||||
Guid runId = Guid.CreateVersion7();
|
||||
_currentExecutionRunId = Optional<Guid>.Some(runId);
|
||||
Status = ScheduledJobStatus.Running;
|
||||
LastStartedOnUtc = Optional<DateTime>.Some(DateTime.UtcNow);
|
||||
_domainEvents.Add(new ScheduledJobExecutionStartedDomainEvent(Guid.NewGuid(), Id, runId, TaskType, isCycleRun, DateTime.UtcNow));
|
||||
_domainEvents.Add(new ScheduledJobExecutionStartedDomainEvent(Guid.CreateVersion7(), Id, runId, TaskType, isCycleRun, DateTime.UtcNow));
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class ScheduledJob : AggregateRoot<ScheduledJobId>
|
||||
// A cycle run returns the scheduled job to its active state, where it waits for the next execution; a one time execution finishes the scheduled job.
|
||||
Status = isCycleRun ? ScheduledJobStatus.Active : ScheduledJobStatus.Completed;
|
||||
LastCompletedOnUtc = Optional<DateTime>.Some(DateTime.UtcNow);
|
||||
_domainEvents.Add(new ScheduledJobExecutionCompletedDomainEvent(Guid.NewGuid(), Id, runId, TaskType, isCycleRun, DateTime.UtcNow));
|
||||
_domainEvents.Add(new ScheduledJobExecutionCompletedDomainEvent(Guid.CreateVersion7(), Id, runId, TaskType, isCycleRun, DateTime.UtcNow));
|
||||
return Result.Success;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class ScheduledJobId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="ScheduledJobId"/> instance.</returns>
|
||||
public static ScheduledJobId CreateUnique()
|
||||
{
|
||||
return new ScheduledJobId(Guid.NewGuid());
|
||||
return new ScheduledJobId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class UserId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="UserId"/> instance.</returns>
|
||||
public static UserId CreateUnique()
|
||||
{
|
||||
return new UserId(Guid.NewGuid());
|
||||
return new UserId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class UserSettingsId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="UserSettingsId"/> instance.</returns>
|
||||
public static UserSettingsId CreateUnique()
|
||||
{
|
||||
return new UserSettingsId(Guid.NewGuid());
|
||||
return new UserSettingsId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ public sealed class MovieId : EntityId<Guid>
|
||||
public static MovieId CreateUnique()
|
||||
{
|
||||
// TODO: enforce invariants.
|
||||
return new MovieId(Guid.NewGuid());
|
||||
return new MovieId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public sealed class EpisodeId : EntityId<Guid>
|
||||
public static EpisodeId CreateUnique()
|
||||
{
|
||||
// TODO: enforce invariants.
|
||||
return new EpisodeId(Guid.NewGuid());
|
||||
return new EpisodeId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public sealed class SeasonId : EntityId<Guid>
|
||||
public static SeasonId CreateUnique()
|
||||
{
|
||||
// TODO: enforce invariants.
|
||||
return new SeasonId(Guid.NewGuid());
|
||||
return new SeasonId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ public sealed class TvShowId : EntityId<Guid>
|
||||
public static TvShowId CreateUnique()
|
||||
{
|
||||
// TODO: enforce invariants.
|
||||
return new TvShowId(Guid.NewGuid());
|
||||
return new TvShowId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class BookId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="BookId"/> instance.</returns>
|
||||
public static BookId CreateUnique()
|
||||
{
|
||||
return new BookId(Guid.NewGuid());
|
||||
return new BookId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public sealed class BookSeriesId : ValueObject
|
||||
/// <returns>The created <see cref="BookSeriesId"/> instance.</returns>
|
||||
public static BookSeriesId CreateUnique()
|
||||
{
|
||||
return new BookSeriesId(Guid.NewGuid());
|
||||
return new BookSeriesId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class LibraryId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="LibraryId"/> instance.</returns>
|
||||
public static LibraryId CreateUnique()
|
||||
{
|
||||
return new LibraryId(Guid.NewGuid());
|
||||
return new LibraryId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ public sealed class MediaContributorId : EntityId<Guid>
|
||||
/// <returns>The created <see cref="MediaContributorId"/> instance.</returns>
|
||||
public static MediaContributorId CreateUnique()
|
||||
{
|
||||
return new MediaContributorId(Guid.NewGuid());
|
||||
return new MediaContributorId(Guid.CreateVersion7());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
+1
@@ -61,6 +61,7 @@ internal sealed class PlaybackDeliveryHandleService : IPlaybackDeliveryHandleSer
|
||||
EnforceGlobalLimit();
|
||||
|
||||
// The handle is a random opaque value, not a derived one, so it cannot be computed from the track or the file by a caller.
|
||||
// It stays a version 4 GUID on purpose: version 7 embeds the creation time and leaves fewer random bits for an unguessable handle.
|
||||
string deliveryId = Guid.NewGuid().ToString("N");
|
||||
DateTimeOffset expiresAtUtc = now.Add(s_deliveryLifetime);
|
||||
_deliveries[deliveryId] = new StoredDelivery(delivery, signature, expiresAtUtc);
|
||||
|
||||
+4
-4
@@ -169,7 +169,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
}
|
||||
|
||||
// This job finished, increment the number of processed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
@@ -248,7 +248,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
|
||||
fingerprintBatch.Add(new DirectoryScanFingerprintEntity()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = LibraryId.Value,
|
||||
Path = currentDirectory.Path,
|
||||
LastWriteTimeUtc = currentLastWriteTimeUtc
|
||||
@@ -386,7 +386,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
|
||||
return new LibraryScanStagingResultsEntity()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryScanId = ScanId.Value,
|
||||
Path = filePath.Path,
|
||||
Size = size,
|
||||
@@ -414,7 +414,7 @@ internal sealed class MusicFileSystemDiscoveryJob : MediaLibraryScanJob, IMusicF
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+2
-2
@@ -626,7 +626,7 @@ internal sealed class MusicMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
|
||||
{
|
||||
return new MusicArtworkEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
OwnerType = ownerType,
|
||||
OwnerId = ownerId,
|
||||
ArtworkType = artworkType,
|
||||
@@ -659,7 +659,7 @@ internal sealed class MusicMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), libraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), libraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+3
-3
@@ -257,7 +257,7 @@ internal sealed class MusicMediaLibraryScanItemMaterializer : IMediaLibraryScanI
|
||||
{
|
||||
return new ArtistEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
Name = name,
|
||||
MusicBrainzArtistId = musicBrainzArtistId,
|
||||
@@ -284,7 +284,7 @@ internal sealed class MusicMediaLibraryScanItemMaterializer : IMediaLibraryScanI
|
||||
MusicLibraryScanItemMetadataEntity firstStagedItem = stagedItems[0];
|
||||
return new AlbumEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
ArtistId = artistId,
|
||||
LibraryId = libraryId,
|
||||
Title = title,
|
||||
@@ -311,7 +311,7 @@ internal sealed class MusicMediaLibraryScanItemMaterializer : IMediaLibraryScanI
|
||||
{
|
||||
return new TrackEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
AlbumId = albumId,
|
||||
LibraryId = libraryId,
|
||||
Path = stagedItem.Path,
|
||||
|
||||
+1
-1
@@ -586,7 +586,7 @@ internal sealed class MusicMediaLibraryScanMetadataEnricher : IMediaLibraryScanM
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), libraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), libraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+3
-3
@@ -154,7 +154,7 @@ internal sealed class MusicMetadataExtractionJob : MediaLibraryScanJob, IMusicMe
|
||||
}
|
||||
|
||||
// This job finished, increment the number of processed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
@@ -319,7 +319,7 @@ internal sealed class MusicMetadataExtractionJob : MediaLibraryScanJob, IMusicMe
|
||||
|
||||
return new MusicLibraryScanItemMetadataEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryScanId = ScanId.Value,
|
||||
LibraryId = LibraryId.Value,
|
||||
Path = path,
|
||||
@@ -563,7 +563,7 @@ internal sealed class MusicMetadataExtractionJob : MediaLibraryScanJob, IMusicMe
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+2
-2
@@ -76,11 +76,11 @@ internal sealed class MediaLibraryScanArtworkEnrichmentJob : MediaLibraryScanJob
|
||||
await artworkEnricher.EnrichAsync(LibraryId, ScanId, UserId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Increment the number of completed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
// When this job has no linked children, it is the last job in the directed acyclic job graph, and the scan is completed.
|
||||
if (Children.Count == 0)
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFinishedDomainEvent(Guid.NewGuid(), compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFinishedDomainEvent(Guid.CreateVersion7(), compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
foreach (IMediaLibraryScanJob child in Children)
|
||||
|
||||
+2
-2
@@ -76,7 +76,7 @@ internal sealed class MediaLibraryScanDiffJob : MediaLibraryScanJob, IMediaLibra
|
||||
throw new InvalidOperationException(publishJobProgressResult.FirstError.Description);
|
||||
|
||||
// This job finished, increment the number of processed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
@@ -112,7 +112,7 @@ internal sealed class MediaLibraryScanDiffJob : MediaLibraryScanJob, IMediaLibra
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+2
-2
@@ -132,7 +132,7 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
}
|
||||
|
||||
// This job finished, increment the number of processed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
@@ -168,7 +168,7 @@ internal sealed class MediaLibraryScanHashJob : MediaLibraryScanJob, IMediaLibra
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+2
-2
@@ -76,11 +76,11 @@ internal sealed class MediaLibraryScanMetadataEnrichmentJob : MediaLibraryScanJo
|
||||
await metadataEnricher.EnrichAsync(LibraryId, ScanId, UserId, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Increment the number of completed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
// When this job has no linked children, it is the last job in the directed acyclic job graph, and the scan is completed.
|
||||
if (Children.Count == 0)
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFinishedDomainEvent(Guid.NewGuid(), compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFinishedDomainEvent(Guid.CreateVersion7(), compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
foreach (IMediaLibraryScanJob child in Children)
|
||||
|
||||
+4
-4
@@ -147,7 +147,7 @@ internal sealed class MediaLibraryScanProviderConfigurationInvalidationJob : Med
|
||||
library.ArtworkProvidersConfigurationFingerprint = artworkFingerprint;
|
||||
library.PathTemplateFingerprint = pathTemplateFingerprint;
|
||||
library.UpdatedOnUtc = DateTime.UtcNow;
|
||||
library.UpdatedBy = Guid.NewGuid();
|
||||
library.UpdatedBy = Guid.CreateVersion7();
|
||||
|
||||
Result<Success> saveChangesResult = await unitOfWork.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
|
||||
if (saveChangesResult.IsFailure)
|
||||
@@ -159,11 +159,11 @@ internal sealed class MediaLibraryScanProviderConfigurationInvalidationJob : Med
|
||||
throw new InvalidOperationException(publishJobProgressResult.FirstError.Description);
|
||||
|
||||
// Increment the number of completed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
// When this job has no linked children, it is the last job in the directed acyclic job graph, and the scan is completed.
|
||||
if (Children.Count == 0)
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFinishedDomainEvent(Guid.NewGuid(), compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFinishedDomainEvent(Guid.CreateVersion7(), compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
foreach (IMediaLibraryScanJob child in Children)
|
||||
@@ -198,7 +198,7 @@ internal sealed class MediaLibraryScanProviderConfigurationInvalidationJob : Med
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+4
-4
@@ -106,7 +106,7 @@ internal sealed class MediaLibraryScanResultsSaveJob : MediaLibraryScanJob, IMed
|
||||
foreach (string deletedPath in getDeletedPathsResult.Value)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
await domainEventPublisher.PublishAsync(new LibraryMediaItemDeletedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, deletedPath, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryMediaItemDeletedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, deletedPath, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
// Materialize the media library items from the scan snapshot, so that they are browsable even without web metadata.
|
||||
@@ -133,11 +133,11 @@ internal sealed class MediaLibraryScanResultsSaveJob : MediaLibraryScanJob, IMed
|
||||
throw new InvalidOperationException(publishJobProgressResult.FirstError.Description);
|
||||
|
||||
// Increment the number of completed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
// When this job has no linked children, it is the last job in the directed acyclic job graph, and the scan is completed.
|
||||
if (Children.Count == 0)
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFinishedDomainEvent(Guid.NewGuid(), compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFinishedDomainEvent(Guid.CreateVersion7(), compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
foreach (IMediaLibraryScanJob child in Children)
|
||||
@@ -171,7 +171,7 @@ internal sealed class MediaLibraryScanResultsSaveJob : MediaLibraryScanJob, IMed
|
||||
if (scanJobProgressResult.IsFailure)
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ internal static class ScanFailurePublisher
|
||||
{
|
||||
await using AsyncServiceScope asyncServiceScope = serviceScopeFactory.CreateAsyncScope();
|
||||
IDomainEventPublisher domainEventPublisher = asyncServiceScope.ServiceProvider.GetService<IDomainEventPublisher>()!;
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFailedDomainEvent(Guid.NewGuid(), libraryId, compositeKey, DateTime.UtcNow, Optional<string>.FromNullable(exception.Message)), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanFailedDomainEvent(Guid.CreateVersion7(), libraryId, compositeKey, DateTime.UtcNow, Optional<string>.FromNullable(exception.Message)), cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
+4
-4
@@ -170,7 +170,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
}
|
||||
|
||||
// This job finished, increment the number of processed jobs progress.
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.NewGuid(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanProgressChangedDomainEvent(Guid.CreateVersion7(), LibraryId, compositeKey, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Status = LibraryScanJobStatus.Completed;
|
||||
|
||||
// Call each linked child with the obtained payload.
|
||||
@@ -237,7 +237,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
|
||||
fingerprintBatch.Add(new DirectoryScanFingerprintEntity()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = LibraryId.Value,
|
||||
Path = currentDirectory.FullName,
|
||||
LastWriteTimeUtc = currentLastWriteTimeUtc
|
||||
@@ -389,7 +389,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
{
|
||||
return new LibraryScanStagingResultsEntity()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryScanId = ScanId.Value,
|
||||
Path = file.FullName,
|
||||
Size = file.Length,
|
||||
@@ -417,7 +417,7 @@ internal sealed class BooksFileSystemDiscoveryJob : MediaLibraryScanJob, IBooksF
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), LibraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+6
-6
@@ -210,7 +210,7 @@ internal sealed class BooksMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
|
||||
{
|
||||
coverArtwork.Status = ArtworkStatus.Failed;
|
||||
coverArtwork.UpdatedOnUtc = DateTime.UtcNow;
|
||||
coverArtwork.UpdatedBy = Guid.NewGuid();
|
||||
coverArtwork.UpdatedBy = Guid.CreateVersion7();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -240,7 +240,7 @@ internal sealed class BooksMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
|
||||
{
|
||||
existingCoverArtwork.Status = ArtworkStatus.Failed;
|
||||
existingCoverArtwork.UpdatedOnUtc = DateTime.UtcNow;
|
||||
existingCoverArtwork.UpdatedBy = Guid.NewGuid();
|
||||
existingCoverArtwork.UpdatedBy = Guid.CreateVersion7();
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ internal sealed class BooksMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
|
||||
existingCoverArtwork.Provider = resolvedArtwork.ProviderName;
|
||||
existingCoverArtwork.LastUpdateUtc = DateTime.UtcNow;
|
||||
existingCoverArtwork.UpdatedOnUtc = DateTime.UtcNow;
|
||||
existingCoverArtwork.UpdatedBy = Guid.NewGuid();
|
||||
existingCoverArtwork.UpdatedBy = Guid.CreateVersion7();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -272,7 +272,7 @@ internal sealed class BooksMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
|
||||
existingCoverArtwork.Provider = resolvedArtwork.ProviderName;
|
||||
existingCoverArtwork.LastUpdateUtc = DateTime.UtcNow;
|
||||
existingCoverArtwork.UpdatedOnUtc = DateTime.UtcNow;
|
||||
existingCoverArtwork.UpdatedBy = Guid.NewGuid();
|
||||
existingCoverArtwork.UpdatedBy = Guid.CreateVersion7();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ internal sealed class BooksMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
|
||||
{
|
||||
return new BookArtworkEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
BookId = bookId,
|
||||
ArtworkType = ArtworkType.Cover,
|
||||
Ordinal = 0,
|
||||
@@ -364,7 +364,7 @@ internal sealed class BooksMediaLibraryScanArtworkEnricher : IMediaLibraryScanAr
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), libraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), libraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ internal sealed class BooksMediaLibraryScanItemMaterializer : IMediaLibraryScanI
|
||||
|
||||
return new BookEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = library.Id.Value,
|
||||
Path = path,
|
||||
Title = title,
|
||||
|
||||
+3
-3
@@ -221,7 +221,7 @@ internal sealed class BooksMediaLibraryScanMetadataEnricher : IMediaLibraryScanM
|
||||
// No metadata provider returned usable metadata, so the book is marked as failed to enrich, keeping its previous metadata.
|
||||
bookEntity.MetadataStatus = MetadataStatus.Failed;
|
||||
bookEntity.UpdatedOnUtc = DateTime.UtcNow;
|
||||
bookEntity.UpdatedBy = Guid.NewGuid();
|
||||
bookEntity.UpdatedBy = Guid.CreateVersion7();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ internal sealed class BooksMediaLibraryScanMetadataEnricher : IMediaLibraryScanM
|
||||
continue;
|
||||
linkedContributors.Add(new BookContributorEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
BookId = bookEntity.Id,
|
||||
MediaContributorId = contributorEntity.Id,
|
||||
Role = role,
|
||||
@@ -395,7 +395,7 @@ internal sealed class BooksMediaLibraryScanMetadataEnricher : IMediaLibraryScanM
|
||||
return scanJobProgressResult.Errors;
|
||||
|
||||
await domainEventPublisher.PublishAsync(new LibraryScanJobProgressChangedDomainEvent(
|
||||
Guid.NewGuid(), libraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
Guid.CreateVersion7(), libraryId, compositeKey, scanJobProgressResult.Value, DateTime.UtcNow), cancellationToken).ConfigureAwait(false);
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ internal sealed class MediaLibraryScanProcessorJob : BackgroundService
|
||||
|
||||
// The file system discovery job is the only top level job of the scan job graph, and every job awaits its children, so awaiting it
|
||||
// completes the entire scan. The next queued scan is only dequeued once this call returns.
|
||||
await rootJob.ExecuteAsync(Guid.NewGuid(), new { }, linkedSource.Token).ConfigureAwait(false);
|
||||
await rootJob.ExecuteAsync(Guid.CreateVersion7(), new { }, linkedSource.Token).ConfigureAwait(false);
|
||||
|
||||
_logger.LogInformation("Completed the media library scan '{ScanId}' of the media library '{LibraryId}'.", compositeId.ScanId.Value, libraryScan.LibraryId.Value);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
// columns are left at their defaults because the persistence layer stamps them when the row is saved.
|
||||
LibraryBookReaderConfigurationEntity configuration = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = false,
|
||||
@@ -333,7 +333,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
// columns are left at their defaults because the persistence layer stamps them when the row is saved.
|
||||
LibraryBookReaderConfigurationEntity configuration = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = false,
|
||||
@@ -384,7 +384,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
// the audit columns are left at their defaults because the persistence layer stamps them when the row is saved.
|
||||
LibraryMetadataProviderConfigurationEntity configuration = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = false,
|
||||
@@ -437,7 +437,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
// audit columns are left at their defaults because the persistence layer stamps them when the row is saved.
|
||||
LibraryArtworkProviderConfigurationEntity configuration = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = false,
|
||||
@@ -479,7 +479,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
// the audit columns are left at their defaults because the persistence layer stamps them when the row is saved.
|
||||
LibraryMetadataProviderConfigurationEntity configuration = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = false,
|
||||
@@ -521,7 +521,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
// audit columns are left at their defaults because the persistence layer stamps them when the row is saved.
|
||||
LibraryArtworkProviderConfigurationEntity configuration = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = false,
|
||||
@@ -578,7 +578,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
bool isEnabled = enabledStatesByPluginId.GetValueOrDefault(pluginId) ?? storedConfiguration?.IsEnabled ?? false;
|
||||
LibraryMetadataProviderConfigurationEntity configuration = storedConfiguration ?? new LibraryMetadataProviderConfigurationEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = isEnabled,
|
||||
@@ -636,7 +636,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
bool isEnabled = enabledStatesByPluginId.GetValueOrDefault(pluginId) ?? storedConfiguration?.IsEnabled ?? false;
|
||||
LibraryArtworkProviderConfigurationEntity configuration = storedConfiguration ?? new LibraryArtworkProviderConfigurationEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = isEnabled,
|
||||
@@ -693,7 +693,7 @@ internal sealed class MediaLibraryProviderConfigurationStore : IMediaLibraryProv
|
||||
bool isEnabled = enabledStatesByPluginId.GetValueOrDefault(pluginId) ?? storedConfiguration?.IsEnabled ?? false;
|
||||
LibraryBookReaderConfigurationEntity configuration = storedConfiguration ?? new LibraryBookReaderConfigurationEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
LibraryId = libraryId,
|
||||
PluginId = pluginId,
|
||||
IsEnabled = isEnabled,
|
||||
|
||||
@@ -184,7 +184,7 @@ public sealed class ScheduledJobSchedulerJob : BackgroundService, IScheduledJobS
|
||||
Guid ownerUserId = scheduledJobs[0].OwnerUserId;
|
||||
ScheduledJobEntity technicalDataCleanupJob = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
Name = "Technical data cleanup at startup",
|
||||
TaskType = ScheduledTaskType.TechnicalDataCleanup,
|
||||
ScheduleType = ScheduleType.OnceAtStartup,
|
||||
|
||||
@@ -95,7 +95,7 @@ internal static class ThemeSynchronizer
|
||||
|
||||
ThemeEntity themeEntity = new()
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = Guid.CreateVersion7(),
|
||||
ThemeId = manifestResult.Value.Id,
|
||||
Name = manifestResult.Value.Name,
|
||||
Description = manifestResult.Value.Description,
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
<File Path="../docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0017.md" />
|
||||
<File Path="../docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0018.md" />
|
||||
<File Path="../docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0019.md" />
|
||||
<File Path="../docs/technical/architecture/architecture-knowledge-management/architecture-decision-log/architecture-decision-record-0020.md" />
|
||||
</Folder>
|
||||
<Folder Name="/docs/technical/domain/">
|
||||
<File Path="../docs/technical/domain/Aggregates.AudioLibrary.md" />
|
||||
|
||||
Reference in new issue
Block a user