Skip to content

Commit

Permalink
Remove unnecessary backend code
Browse files Browse the repository at this point in the history
  • Loading branch information
simpat-adam committed Jan 9, 2025
1 parent 52bcadf commit 2d7b4fb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,7 @@ await _sqlAction.InsertAlias(
}

_logger.LogDebug("Upsert success as insert - {TraceId}", upsertRequest.TraceId.Value);
return new UpsertResult.InsertSuccess(
upsertRequest.DocumentUuid,
new Etag(upsertRequest.EdfiDoc["_etag"]?.ToString() ?? "")
);
return new UpsertResult.InsertSuccess(upsertRequest.DocumentUuid);
}

public async Task<UpsertResult> AsUpdate(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ public record UpsertResult
/// A successful upsert request that took the form of an insert
/// </summary>
/// <param name="NewDocumentUuid">The DocumentUuid of the new document</param>
/// <param name="Etag">The Etag of the new document</param>
public record InsertSuccess(DocumentUuid NewDocumentUuid, Etag Etag) : UpsertResult();
public record InsertSuccess(DocumentUuid NewDocumentUuid) : UpsertResult();

/// <summary>
/// A successful upsert request that took the form of an update
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public async Task<UpsertResult> UpsertDocument(IUpsertRequest upsertRequest)
upsertRequest.TraceId
);
return await Task.FromResult<UpsertResult>(
new UpsertResult.InsertSuccess(upsertRequest.DocumentUuid, new Etag(""))
new UpsertResult.InsertSuccess(upsertRequest.DocumentUuid)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public async Task Execute(PipelineContext context, Func<Task> next)
context.FrontendResponse = upsertResult switch
{
InsertSuccess insertSuccess => new FrontendResponse(
StatusCode: 201,
Body: null,
Headers: new Dictionary<string, string>() { { "etag", insertSuccess.Etag.Value } },
StatusCode: 201,
Body: null,
Headers: new Dictionary<string, string>() { { "etag", context.ParsedBody["_etag"]?.ToString() ?? "" } },
LocationHeaderPath: PathComponents.ToResourcePath(
context.PathComponents,
insertSuccess.NewDocumentUuid
Expand All @@ -70,7 +70,7 @@ public async Task Execute(PipelineContext context, Func<Task> next)
UpdateSuccess updateSuccess => new(
StatusCode: 200,
Body: null,
Headers: [],
Headers: new Dictionary<string, string>() { { "etag", context.ParsedBody["_etag"]?.ToString() ?? "" } },
LocationHeaderPath: PathComponents.ToResourcePath(
context.PathComponents,
updateSuccess.ExistingDocumentUuid
Expand Down

0 comments on commit 2d7b4fb

Please sign in to comment.