Create endpoint to get and update Partner admins
Closed this issue · 4 comments
Overview
We need to restrict access to users who are no longer partner admins. However, we want to keep the history of whether a user is a partner admin. We have created an active column in the partner admin table.
In bloom-frontend there is a Super Admin dashboard on /admin/dashboard. This feature will loosely follow the pattern of the UpdateTherapyAdminForm in Bloom-frontend.
What our new admin form will need is:
- Access to the GET /user point. The Get user endpoint query will need to be able to include the partner admin table and filter by whether the partner admin row exists or not. i.e. you would get a searchQuery which might have
{ "relations": ["partner-admin"], "partnerAdmin": { "partnerAdminId": "IS NOT NULL"} }
Note that this endpoint should now optionally return a users partnerAdmin data. - A PATCH endpoint
/partner-admin/:id
which takes a body with the updates to make. Please ensure this is behind Super Admin Authentication. In this case the body will be
{ "active": Boolean }
These changes should unblock this issue on Bloom-frontend.
Action Items
- Take a look at the implentation of GET /user and PATCH /partner-access/:id. You will be following the implementations of these endpoints
- Make the changes listed above to the GET
/user
endpoint and service methods and write adequate service tests and optional controller test - Create a PATCH
/partner-admin/:id
endpoint and with service method. This should be super admin authenticated that takes the body stated above. Ensure the appropriate DTO is created as well. - Commit and Push to your branch
- Tag @eleanorreem in your PR
@eleanorreem I would like to work on this task.
@jobayer12 thanks for your interest, you are assigned! :)
@kyleecodes @eleanorreem Is it possible to share the local environment database? Because I haven't any data in my local database that's why I can't test it properly. It would be nice if anyone shared it with me. I can work properly on the next task.
@jobayer12 Thanks for your interest!
Yes here is the link. You can skip to the section on Bloom Backend where you'll see a file download for our testing db.