From 034c3dce8c8274df57278c93d55d493f7656ef45 Mon Sep 17 00:00:00 2001 From: Kevin Hahn Date: Tue, 15 Oct 2024 10:05:51 +0700 Subject: [PATCH] fix some lingering issues after updating --- src/SIL.Harmony.Sample/CrdtSampleKernel.cs | 1 + src/SIL.Harmony/Changes/ChangeContext.cs | 2 +- src/SIL.Harmony/DataModel.cs | 1 + src/SIL.Harmony/Db/CrdtRepository.cs | 1 + src/SIL.Harmony/Resource/CreateRemoteResourceChange.cs | 4 ++-- src/SIL.Harmony/Resource/CreateRemoteResourcePendingUpload.cs | 4 ++-- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/SIL.Harmony.Sample/CrdtSampleKernel.cs b/src/SIL.Harmony.Sample/CrdtSampleKernel.cs index 7f4c3b6..6830fae 100644 --- a/src/SIL.Harmony.Sample/CrdtSampleKernel.cs +++ b/src/SIL.Harmony.Sample/CrdtSampleKernel.cs @@ -36,6 +36,7 @@ public static IServiceCollection AddCrdtDataSample(this IServiceCollection servi services.AddCrdtData(config => { config.EnableProjectedTables = true; + config.AddRemoteResourceEntity(); config.ChangeTypeListBuilder .Add() .Add() diff --git a/src/SIL.Harmony/Changes/ChangeContext.cs b/src/SIL.Harmony/Changes/ChangeContext.cs index 15c10d7..bdcf911 100644 --- a/src/SIL.Harmony/Changes/ChangeContext.cs +++ b/src/SIL.Harmony/Changes/ChangeContext.cs @@ -25,5 +25,5 @@ internal ChangeContext(Commit commit, SnapshotWorker worker, CrdtConfig crdtConf } public async ValueTask IsObjectDeleted(Guid entityId) => (await GetSnapshot(entityId))?.EntityIsDeleted ?? true; - internal IObjectBase Adapt(object obj) => _crdtConfig.ObjectTypeListBuilder.AdapterProvider.Adapt(obj); + internal IObjectBase Adapt(object obj) => _crdtConfig.ObjectTypeListBuilder.Adapt(obj); } diff --git a/src/SIL.Harmony/DataModel.cs b/src/SIL.Harmony/DataModel.cs index c766332..2b13e0f 100644 --- a/src/SIL.Harmony/DataModel.cs +++ b/src/SIL.Harmony/DataModel.cs @@ -5,6 +5,7 @@ using SIL.Harmony.Changes; using SIL.Harmony.Db; using SIL.Harmony.Entities; +using SIL.Harmony.Resource; namespace SIL.Harmony; diff --git a/src/SIL.Harmony/Db/CrdtRepository.cs b/src/SIL.Harmony/Db/CrdtRepository.cs index 4089b15..20dc305 100644 --- a/src/SIL.Harmony/Db/CrdtRepository.cs +++ b/src/SIL.Harmony/Db/CrdtRepository.cs @@ -6,6 +6,7 @@ using SIL.Harmony.Changes; using SIL.Harmony.Entities; using SIL.Harmony.Helpers; +using SIL.Harmony.Resource; namespace SIL.Harmony.Db; diff --git a/src/SIL.Harmony/Resource/CreateRemoteResourceChange.cs b/src/SIL.Harmony/Resource/CreateRemoteResourceChange.cs index 41ded57..aa4f821 100644 --- a/src/SIL.Harmony/Resource/CreateRemoteResourceChange.cs +++ b/src/SIL.Harmony/Resource/CreateRemoteResourceChange.cs @@ -7,9 +7,9 @@ namespace SIL.Harmony.Resource; public class CreateRemoteResourceChange(Guid resourceId, string remoteId) : CreateChange(resourceId), IPolyType { public string RemoteId { get; set; } = remoteId; - public override ValueTask NewEntity(Commit commit, ChangeContext context) + public override ValueTask NewEntity(Commit commit, ChangeContext context) { - return ValueTask.FromResult(new RemoteResource + return ValueTask.FromResult(new RemoteResource { Id = EntityId, RemoteId = RemoteId diff --git a/src/SIL.Harmony/Resource/CreateRemoteResourcePendingUpload.cs b/src/SIL.Harmony/Resource/CreateRemoteResourcePendingUpload.cs index a31f292..4859f8d 100644 --- a/src/SIL.Harmony/Resource/CreateRemoteResourcePendingUpload.cs +++ b/src/SIL.Harmony/Resource/CreateRemoteResourcePendingUpload.cs @@ -9,9 +9,9 @@ public CreateRemoteResourcePendingUploadChange(Guid resourceId) : base(resourceI { } - public override ValueTask NewEntity(Commit commit, ChangeContext context) + public override ValueTask NewEntity(Commit commit, ChangeContext context) { - return ValueTask.FromResult(new RemoteResource + return ValueTask.FromResult(new RemoteResource { Id = EntityId });