-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
feat(#6543): adds api-side support for users with multiple facilities #9126
Conversation
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
…ulti-facility # Conflicts: # shared-libs/contacts/test/unit/places.spec.js # shared-libs/user-management/src/users.js # shared-libs/user-management/test/unit/users.spec.js # tests/integration/api/controllers/users.spec.js
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dianabarsan this is great! Thanks a lot
I left few comments as I was reading to understand the changes
I tested the app and seems to work fine for users with 1 facility and with more than one:
I was able to create and update users:
When I change or add a facility to the user, my session expires, then I login, I still the see the old stuff, but after sync, I see the facilities updated.
const getCommonFieldsUpdates = (userDoc, data) => { | ||
getRolesUpdates(data); | ||
if (data.roles) { | ||
userDoc.roles = data.roles; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const getCommonFieldsUpdates = (userDoc, data) => { | |
getRolesUpdates(data); | |
if (data.roles) { | |
userDoc.roles = data.roles; | |
} | |
const setCommonFieldsUpdates = (userDoc, data) => { | |
const roles = getRolesUpdates(data); | |
if (roles) { | |
userDoc.roles = roles; | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to update the create-user URL to point to v3
@Benmuiruri, I think you can use v3 for single user, and keep v2 for multiple users. |
Please feel free to dismiss my review to not block this PR 🙂 |
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Hi @dianabarsan Jenni's comment suggests we should not change the However, that's not correct since the createMultipleUsers is for bulk uploading users... just a heads up on that. |
Hi @Benmuiruri We are not going to change the bulk create in this iteration to support multiple facilities. |
That's okay. But as it is... When I create a new user it goes to the v2 URL and fails |
Can you send the bulk request to v2 and the single request to v3? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great point @Benmuiruri . I'll handle this case as well. |
Signed-off-by: Diana Barsan <barsan@medic.org>
Signed-off-by: Diana Barsan <barsan@medic.org>
Hi @dianabarsan I believe this is ready to merge after Jenni and I reviewed it. Please rebase and merge if all is good so that I can rebase and merge Jenni's branches and my branches. Thanks. |
I think I added one more commit after your last review, that validates that the places list is correct, so we handle:
The response is still 400 I believe, but this edge case is handled in code and tested for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the empty facility array check
Description
Covers:
Implementation details:
Does not cover:
#6543
Code review checklist
Compose URLs
If Build CI hasn't passed, these may 404:
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.