-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add Delete Role API #56
Comments
I am Interested to code this |
Yes please |
|
/attempt 1 |
Hi @Code-With-Abhishek-Kumar, As you can see in Edge Case:
let me know if you have any doubt. |
Okay Got it |
How can i pass These Credential so that i can test application in my local |
Please follow these steps to set up the project:
Once all the test cases pass, the project setup is complete. |
|
This means the env constant has not been set correctly. Please refer |
Description:
We need to add functionality for deleting roles in the
user-service
. This API should follow specific constraints to ensure that system-defined roles (default roles) are not deleted, while roles created by users can be deleted under the right conditions.Key Requirements
1. Role Deletion Constraints
canBeDeleted
in theRole
model to mark which roles are deletable.2. Authentication & Authorization:
validateAccessToken
middleware to authenticate the user.checkPermission(['delete-roles'])
to authorize users with the right permissions to delete roles.3. API Endpoint:
DELETE /roles/:roleId
route to handle role deletion.4. Controller Layer:
deleteRole
method in the controller to handle the incoming request for role deletion.5. Service Layer:
deleteRole
method.canBeDeleted
flag istrue
.6. Data Access Layer (DAL):
deleteRole
method in the DAL to perform the actual deletion of the role in the database.7. Validation:
role.validation.ts
file to handle any necessary validation for role deletion, including checking thecanBeDeleted
flag.8. Existing Code Reference:
The new route and functionality should be consistent with existing routes such as:
9. Tests:
Write unit tests to cover:
Tasks:
canBeDeleted
flag in theRole
model.DELETE /roles/:roleId
endpoint in the router.deleteRole
method in the controller.deleteRole
method in the service.deleteRole
method in the DAL.canBeDeleted = true
can be deleted.validateAccessToken
to authenticate the user.checkPermission(['delete-roles'])
to authorize the user.role.validation.ts
with any necessary validation logic.Acceptance Criteria:
canBeDeleted
istrue
.The text was updated successfully, but these errors were encountered: