Skip to content

Commit 2a5ba8a

Browse files
committed
Make fwdata api respect nullable return types
1 parent 3696ef5 commit 2a5ba8a

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

backend/FwLite/FwDataMiniLcmBridge/Api/FwDataMiniLcmApi.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,8 @@ public IAsyncEnumerable<Entry> SearchEntries(string query, QueryOptions? options
953953

954954
public Task<Entry?> GetEntry(Guid id)
955955
{
956-
return Task.FromResult<Entry?>(FromLexEntry(EntriesRepository.GetObject(id)));
956+
EntriesRepository.TryGetObject(id, out var lexEntry);
957+
return Task.FromResult(lexEntry is null ? null : FromLexEntry(lexEntry));
957958
}
958959

959960
public async Task<Entry> CreateEntry(Entry entry, CreateEntryOptions? options = null)
@@ -1423,7 +1424,7 @@ private void ApplySenseToLexSense(Sense sense, ILexSense lexSense)
14231424

14241425
public Task<Sense?> GetSense(Guid entryId, Guid id)
14251426
{
1426-
var lcmSense = SenseRepository.GetObject(id);
1427+
SenseRepository.TryGetObject(id, out var lcmSense);
14271428
return Task.FromResult(lcmSense is null ? null : FromLexSense(lcmSense));
14281429
}
14291430

@@ -1550,7 +1551,7 @@ public Task DeleteSense(Guid entryId, Guid senseId)
15501551

15511552
public Task<ExampleSentence?> GetExampleSentence(Guid entryId, Guid senseId, Guid id)
15521553
{
1553-
var lcmExampleSentence = ExampleSentenceRepository.GetObject(id);
1554+
ExampleSentenceRepository.TryGetObject(id, out var lcmExampleSentence);
15541555
return Task.FromResult(lcmExampleSentence is null ? null : FromLexExampleSentence(senseId, lcmExampleSentence));
15551556
}
15561557

backend/FwLite/FwLiteProjectSync.Tests/CrdtRepairTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public async Task CrdtEntryMissingTranslationId_FwExampleSentenceRemoved_FullSyn
226226
// act
227227
await FwDataApi.DeleteExampleSentence(entryId, senseId, exampleSentenceId);
228228
var result = await SyncService.Sync(CrdtApi, FwDataApi);
229-
result.CrdtChanges.Should().Be(1, "the crdt translation was removed");
229+
result.CrdtChanges.Should().Be(1, "the crdt example-sentence was removed");
230230

231231
// assert - the crdt translation was also removed
232232
var updatedCrdtEntry = await CrdtApi.GetEntry(crdtEntry.Id);

0 commit comments

Comments
 (0)