Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech Debt - move entity updater to lbh core #59

Merged
merged 2 commits into from
Jan 11, 2024

Conversation

LBHCallumM
Copy link
Member

Summary of changes

Many APIs use this EntityUpdater class, so I have moved it to this shared library.

EntityUpdater is used for patch endpoints, where we want to detect if any changes have been made.

Example usage:

var updaterResponse =  _updater.UpdateEntity<AssetDb, EditAssetAddressDatabase>(existingAsset, requestBody, editAddressRequest.ToDatabase());

if (updaterResponse.NewValues.Any())
{
    await _dynamoDbContext.SaveAsync<AssetDb>(updaterResponse.UpdatedEntity).ConfigureAwait(false);
}

BodyRewindMiddleware is required to get the raw request body (to get around .net serialization limitations)

For example:

var bodyText = await HttpContext.Request.GetRawBodyStringAsync().ConfigureAwait(false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants