-
Notifications
You must be signed in to change notification settings - Fork 1
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 subscribe API for COSCUP-Volunteer and API Token management page #7
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: orertrr <[email protected]>
Signed-off-by: orertrr <[email protected]>
Signed-off-by: orertrr <[email protected]>
Signed-off-by: orertrr <[email protected]>
Signed-off-by: orertrr <[email protected]>
Signed-off-by: orertrr <[email protected]>
Signed-off-by: orertrr <[email protected]>
Signed-off-by: orertrr <[email protected]>
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.
@orertrr 先修正關於排序的問題,還有搬移到 API endpoint 中,其他的我再繼續看,怕我卡住太久!
if request.path.startswith('/volunteer'): | ||
token = request.headers.get('Authorization') | ||
if token is None: | ||
return make_response('Unauthorized', 401) | ||
|
||
if APIToken.verify(token) is True: | ||
return None | ||
|
||
return make_response('Unauthorized', 401) | ||
|
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.
@orertrr 這段移到 view/volunteer.py
的每一個 endpoint 去判斷,這裡想要單純的扮演 route 的節點。然後在 Line 78 加入 and not request.path.startswith('/volunteer')
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.
這部分如果包成 function 然後掛一個 VIEW_VOLUNTEER.before_request
的 decorator 上去可以嗎?
理論上這樣寫可以有同樣的效果,且之後 /volunteer
底下有要再加 Endpoint 時也不用再寫同樣的邏輯
models/index.py
Outdated
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.
這個檔案上方 import 好像沒有排序,APITokenDB().index()
應該可以移上去 Line 7。
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.
已修正
main.py
Outdated
app.register_blueprint(VIEW_VOLUNTEER) | ||
app.register_blueprint(VIEW_TOKEN) |
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.
Line 39 - Line 45 這裡排序一下。
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.
已修正
Signed-off-by: orertrr <[email protected]>
Pull request type
Related Issue
What is the new behavior?
Other Informations
新增訂閱者 API
API Token management page