-
Notifications
You must be signed in to change notification settings - Fork 37
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
[Users] Add delete user mutation fixes(#134) #138
[Users] Add delete user mutation fixes(#134) #138
Conversation
Thanks @jugshaurya, for opening the pull request! 🙌 One of our mentors will review the pull request soon. ✅ Star ⭐ this project and tweet 🐦 about your contributions. |
@hereisnaman please review, |
api/services/User/index.js
Outdated
@@ -10,7 +10,7 @@ import Availability from './Loaders/Availability'; | |||
|
|||
export default class User extends BaseModelService { | |||
static findByUsername(username) { | |||
return Models.User.findOne({ where: { username } }); | |||
return Models.User.findOne({ where: { username }, paranoid: false }); |
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.
expect options as a second arg and spread it. While calling from the login callback pass the paranoid as false from there inside the options object.
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.
done
f5726f4
to
fcd00c2
Compare
@hereisnaman, please review. Changes done |
@hereisnaman , testing required means, you are going to test it or I am? |
@hereisnaman, can you help me out how can I test it as no frontend for it is written yet? maybe a new issue should be raised to add this feature with a checklist so that I can add that as well accordingly and test later on! and move on to issue #135 and assign that to me. |
visit localhost:3000/api/graphql in browser and test from there. |
@jugshaurya for impersonation and user listing, you'll need to handle few tasks from #134 Lets include the last 2 tasks from that issue in this PR. |
@hereisnaman, i already included the last 2 tasks from issue #134 in this PR where if deleted_at property is not null, we redirect to homepage. And for cheking for admins test-b is also passing. You can see that in above screenshots |
Then why is " By the way in impersonating form:- once a user is deleted it is not showing there to log in as him/her." this an issue. You can pass the required arguments in the query to display those right. |
@hereisnaman , No that was not an issue, actually, i was saying for the test case c . Once the user is deleted and delete_at is filled, the users that are deleted are not showing in the form , which is what we want. So everything is fine. I was just giving explaination for test case c. await user.loadByUsername(profile.username, { paranoid: false });
if (user.deleted_at) return App.redirectToHome(res); |
app/mutations/userDisable.graphql
Outdated
@@ -0,0 +1,5 @@ | |||
mutation UserDisable($id: ID!) { | |||
disableUser: UserDisable(id: $id) { |
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.
The mutation name is userDisable
, fix the casing.
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.
oh sorry for that typo
- Add a mutation userDisable to delete the user. - The action should only be allowed to admins. - Update login callback to not create a user, if a deleted entity for that user is present
fcd00c2
to
d785ec9
Compare
@hereisnaman, please review |
@hereisnaman, require some more changes? |
Congratualtions @jugshaurya, your pull request is merged! 🎉 Thanks for your contributions and participating in BOSS 2020. 🙌 You can claim your bounty points here. 💰 |
Issue
fixes: #134
Solution
Screenshots (Desktop)
Screenshots (Mobile)
Checklist
PR will only be reviewed if the checklist is completed
master
.