diff --git a/src/Spark.Engine/Extensions/InteractionExtensions.cs b/src/Spark.Engine/Extensions/InteractionExtensions.cs index ec9d5c016..ea77b7847 100644 --- a/src/Spark.Engine/Extensions/InteractionExtensions.cs +++ b/src/Spark.Engine/Extensions/InteractionExtensions.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.Linq; using Spark.Engine.Core; +using System.Net.Http.Headers; namespace Spark.Engine.Extensions; @@ -22,6 +23,10 @@ public static Key ExtractKey(this ILocalhost localhost, Bundle.EntryComponent en if (entry.Request != null && entry.Request.Url != null) { key = localhost.UriToKey(entry.Request.Url); + if (!string.IsNullOrWhiteSpace(entry.Request.IfMatch)) + { + key.VersionId = EntityTagHeaderValue.Parse(entry.Request.IfMatch).Tag.Trim('"'); + } } else if (entry.Resource != null) { diff --git a/src/Spark.Engine/Service/FhirService.cs b/src/Spark.Engine/Service/FhirService.cs index 16126f5ab..73f3bd672 100644 --- a/src/Spark.Engine/Service/FhirService.cs +++ b/src/Spark.Engine/Service/FhirService.cs @@ -336,7 +336,7 @@ public async Task HandleInteractionAsync(Entry interaction) switch (interaction.Method) { case Bundle.HTTPVerb.PUT: - return await PutAsync(interaction).ConfigureAwait(false); + return await UpdateAsync(interaction.Key, interaction.Resource).ConfigureAwait(false); case Bundle.HTTPVerb.POST: return await CreateAsync(interaction).ConfigureAwait(false); case Bundle.HTTPVerb.DELETE: diff --git a/src/Spark.Engine/Service/FhirServiceExtensions/TransactionService.cs b/src/Spark.Engine/Service/FhirServiceExtensions/TransactionService.cs index 1f7e53ede..c76ee15be 100644 --- a/src/Spark.Engine/Service/FhirServiceExtensions/TransactionService.cs +++ b/src/Spark.Engine/Service/FhirServiceExtensions/TransactionService.cs @@ -68,7 +68,8 @@ private async Task>> HandleTransactionAsync(ILi { List> responses = new List>(); - _transfer.Internalize(interactions, mapper); + // each operation will be executed by itself + // _transfer.Internalize(interactions, mapper); foreach (Entry interaction in interactions) { @@ -83,7 +84,7 @@ private async Task>> HandleTransactionAsync(ILi responses.Add(new Tuple(interaction, response)); } - _transfer.Externalize(interactions); + // _transfer.Externalize(interactions); return responses; }