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

#166790110: Super admin should be able to create users #46

Merged
merged 1 commit into from
Jul 31, 2019

Conversation

kagabof
Copy link
Contributor

@kagabof kagabof commented Jul 29, 2019

What does this PR do?

  • Add admin functionalities.

Description of Task to be completed?

  • Added admin controller with crud functionality
  • Added test for the admin functionality.
  • Added routers for the admin functionality,
  • Added swagger documentation for admin functionality.

How should this be manually tested?

Any background context you want to provide?

  • NONE

What are the relevant pivotal tracker stories?

#166790110

Screenshots

Screen Shot 2019-07-29 at 21 39 50

Questions:

  • NONE

@kagabof kagabof force-pushed the ft-super-admin-create-users-166790110 branch 2 times, most recently from ce51e80 to 5d440fc Compare July 29, 2019 21:51
Copy link
Contributor

@FlevianK FlevianK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admin is user the only difference is that he/she can access any other user and perform operations on them as if he/she is the other logged in user.

Kindly implement the reviews.

src/controllers/adminContoller.js Outdated Show resolved Hide resolved
src/controllers/helpers/findUser.js Show resolved Hide resolved
src/routes/adminRoute.js Outdated Show resolved Hide resolved
@kagabof kagabof force-pushed the ft-super-admin-create-users-166790110 branch from 5d440fc to 1686f27 Compare July 30, 2019 13:45
@kagabof kagabof force-pushed the ft-super-admin-create-users-166790110 branch from 1686f27 to dad9ce7 Compare July 30, 2019 15:11
src/test/user.js Outdated Show resolved Hide resolved
@kagabof kagabof force-pushed the ft-super-admin-create-users-166790110 branch 3 times, most recently from 0ba1ec9 to f1f0ade Compare July 30, 2019 18:40
@kagabof kagabof temporarily deployed to ah-jawans-backend July 30, 2019 18:41 Inactive
@kagabof kagabof temporarily deployed to ah-jawans-backend July 30, 2019 18:56 Inactive
@kagabof kagabof force-pushed the ft-super-admin-create-users-166790110 branch from f1f0ade to dacd2f9 Compare July 30, 2019 19:12
@kagabof kagabof temporarily deployed to ah-jawans-backend July 30, 2019 19:23 Inactive
@kagabof kagabof temporarily deployed to ah-jawans-backend July 30, 2019 19:37 Inactive
@kagabof kagabof force-pushed the ft-super-admin-create-users-166790110 branch from dacd2f9 to 98cca19 Compare July 31, 2019 07:36
- Added test for the admin fationality.
- Added routers for the admin factionality,
- Added swagger documentation for admin fanctionality.
@kagabof kagabof force-pushed the ft-super-admin-create-users-166790110 branch from 98cca19 to 256b490 Compare July 31, 2019 07:53

router.delete('/api/users/:id', verifyToken, checkAction('User'), UserController.deleteUser);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you having this action checkAction('User') here and not at the controller level?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkAction is a middleware function that checks if a user trying to access the router has the priority of deleting in a user table.

@@ -31,20 +32,32 @@ class UserProfile {
* @return {object} returns an object containing the updated user profile
*/
static async updateProfile(req, res) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be refactored better during code maintainability session

Copy link
Contributor

@FlevianK FlevianK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implement review that relates to routing

@FlevianK FlevianK merged commit ac35530 into develop Jul 31, 2019
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.

None yet

2 participants