mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-10-02 21:33:54 +00:00
fix(uplifts): return stored evidence after a concurrent create
Map the saved request from the evidence-file lookup, and teach the shared-dispatch conflict test to return that lookup so a winning insert still produces a response. Co-authored-by: Arthur Bassi <bassi-arthurr@users.noreply.github.com>
This commit is contained in:
parent
b11b66538a
commit
1daac954a3
2 changed files with 6 additions and 1 deletions
|
|
@ -56,6 +56,10 @@ public sealed class WorkOrderUpliftServiceConflictTests
|
|||
.ReturnsAsync(0m);
|
||||
upliftData.Setup(x => x.StageAsync(It.IsAny<DispatchUpliftRequest>(), It.IsAny<CancellationToken>()))
|
||||
.Returns(Task.CompletedTask);
|
||||
upliftData.Setup(x => x.GetEvidenceFilesAsync(
|
||||
It.IsAny<IReadOnlyCollection<int>>(),
|
||||
It.IsAny<CancellationToken>()))
|
||||
.ReturnsAsync(new Dictionary<int, IReadOnlyList<UpliftEvidenceFileData>>());
|
||||
upliftData.Setup(x => x.SaveChangesAsync(It.IsAny<CancellationToken>()))
|
||||
.Returns(async () =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -469,7 +469,8 @@ namespace SeaHaven.Services.Implementation
|
|||
Dispatch dispatch,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var files = await _upliftData.GetEvidenceFilesAsync(new[] { request.Id }, cancellationToken);
|
||||
var files = await _upliftData.GetEvidenceFilesAsync(new[] { request.Id }, cancellationToken)
|
||||
?? new Dictionary<int, IReadOnlyList<UpliftEvidenceFileData>>();
|
||||
if (!files.TryGetValue(request.Id, out var attachments))
|
||||
attachments = Array.Empty<UpliftEvidenceFileData>();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue