-
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
#541 24-chuseok event ban middleware #544
base: dev
Are you sure you want to change the base?
Conversation
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.
수고하셨습니다! 코멘트 확인 부탁드려요
error: "eventValidator: internal server error", | ||
}); | ||
} | ||
next(); |
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.
에러 발생했을 땐 next를 호출하면 안됩니다!
src/lottery/modules/contracts.js
Outdated
@@ -109,8 +109,8 @@ const quests = buildQuests({ | |||
* @returns {Promise} | |||
* @usage lottery/globalState - createUserGlobalStateHandler | |||
*/ | |||
const completeFirstLoginQuest = async (userId, timestamp) => { | |||
return await completeQuest(userId, timestamp, quests.firstLogin); | |||
const completeFirstLoginQuest = async (req, userId, timestamp) => { |
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.
req에 이미 userOid가 포함되어 있어서, req를 받을거라면 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.
*/ | ||
const eventValidator = async (req, res, next) => { | ||
try { | ||
const eventStatus = await eventStatusModel |
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.
개인적으로는 이렇게 eventStatus를 가져오는 미들웨어보다는 필요한 services에서만 가져다 쓰는게 좋을 것 같다고 생각해요. 기존 코드에 user를 가져오는 미들웨어가 없고 필요한 services에서 직접 조회해서 쓰는 것처럼요. 물론 성능 차이는 거의 없겠지만, service에 따라 eventStatus를 단순히 조회만 하는 경우가 있고, 수정해야 하는 경우도 있는데 후자의 경우에는 (미들웨어가 있으면) query가 2번 발생하게 됩니다.
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.
계속 사용하는 것으로 결정
…541-24-chuseok-event-ban-middleware
Summary
It closes #541