-
Notifications
You must be signed in to change notification settings - Fork 17
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
API: Leave Group issue solving #27
base: master
Are you sure you want to change the base?
Conversation
app.py
Outdated
@@ -20,5 +21,28 @@ def Login(): | |||
flash('Login Unsuccessful. Invalid Email/Password') | |||
return render_template('login.html',title='Login | SAC Portal, IIT Mandi',form=form) | |||
|
|||
#Example https://host/leaveclub?userID='B19188'&clubID='C10001' | |||
@app.route('/leaveclub', methods = ['GET','POST']) |
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.
- Make this route, POST only
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.
It is showing method not allowed in POST, I thing it is GET, so I have make this route only GET
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.
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.
Also here i have used query params but use request body to transfer data
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.
You have changed the route method, but you are still using query params for data tranfer
|
Fixes #18 I made the changes in app.py as you suggested. |
Also, please don't merge it now, I think merge it after the api of add groups and add members is created, so that they don't get disturbed to update their PR. |
app.py
Outdated
@@ -20,5 +21,28 @@ def Login(): | |||
flash('Login Unsuccessful. Invalid Email/Password') | |||
return render_template('login.html',title='Login | SAC Portal, IIT Mandi',form=form) | |||
|
|||
#Example https://host/leaveclub?userID='B19188'&clubID='C10001' | |||
@app.route('/leaveclub', methods = ['GET','POST']) |
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.
Another thing, You don't need to commit amend or rebase everytime you make a change, |
Okay, I will use only postman. |
app.py
Outdated
def leave_club(): | ||
data = { | ||
"tablename" : "ClubMembers", | ||
"userID" : request.args.get('userID'), |
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.
use request body to transfer data, instead of query parameters,
this'll allow for direct HTML form calls
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.
yes, userstood for sure, will take care from next time in PRs
However, changing it and doing it as vipul suggested, to not take any parameter, isnted use the session value.
@@ -20,5 +21,28 @@ def Login(): | |||
flash('Login Unsuccessful. Invalid Email/Password') | |||
return render_template('login.html',title='Login | SAC Portal, IIT Mandi',form=form) | |||
|
|||
#Example https://host/leaveclub?userID='B19188'&clubID='C10001' | |||
@app.route('/leaveclub', methods = ['POST']) |
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.
Not sure about this comment. @vsvipul @Milind712000 what do you think about this?
Guard this function to check whether the user is logged in. If the user is logged in we don't need to store the userid.
If you are thinking about admin functionalities, we can have a different function for that.
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.
Ok, done, understood.
I will do this.
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.
I will only take the clubID in the body, and take the userID from the session.
Fixes #18
I have make the changes in app.py which adding the API for leaving the group. Also checked it using the postman and it is working. After deleting the data from ClubMembers table, it will return if it is success or not in JSON form.
Also added a file, to see the tables list.