Closed A-Guldborg closed 8 months ago
Hi @jonasanker , it is now ready for re-review based on my above comments/replies to your change-requests.
Please note that I have not added the index that you mentioned in-person. Do you still reckon we should have an index on e.g. UserGroup or something else? π
Failed conditions
0.0% Coverage on New Code (required β₯ 80%)
Implements the endpoint
PUT /api/v2/webhooks/accounts/user-group
, allowing an external service to update user groups in bulk.Example request body:
The X-Api-Key header should be present on the request with a valid API key.
The userGroup should be one of:
Notes on testing
I have been unable to implement an integration test, since EFCore.InMemory does not seem to support the performance-optimized ExecuteUpdate that is implemented in EF Core 7 and used in this service. Reference: https://stackoverflow.com/questions/74907256/ef-7-new-executedelete-and-executeupdate-methods-not-working-on-an-in-memory-d
Business logic
Initially, business logic was implemented using client-side hashing to verify duplicate requests did not use many resources. Later, it was changed to server-side hashing however hashing was completely removed again, as it would cause weird behaviour in combination with the below mentioned existing endpoint. Now it will be clearer that the state in the external system will correct itself if analog-core and the external system are out of sync.
Notes on affected existing endpoints
This change will also mark our
PATCH /api/v2/account/<id>/user-group
endpoint, as any calls to the new endpoint will override any user-groups set by the old patch endpoint. The endpoint is used by the Shifty User Manager from https://github.com/AnalogIO/shifty-webapp/pull/21