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

#541 24-chuseok event ban middleware #544

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from

Conversation

TaehyeonPark
Copy link
Contributor

Summary

It closes #541

@TaehyeonPark TaehyeonPark linked an issue Sep 6, 2024 that may be closed by this pull request
1 task
@kmc7468 kmc7468 self-requested a review September 7, 2024 06:44
Copy link
Member

@kmc7468 kmc7468 left a 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();
Copy link
Member

Choose a reason for hiding this comment

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

에러 발생했을 땐 next를 호출하면 안됩니다!

@@ -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) => {
Copy link
Member

Choose a reason for hiding this comment

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

req에 이미 userOid가 포함되어 있어서, req를 받을거라면 userId 매개변수는 필요하지 않을 것 같습니다. (주석도 업데이트 부탁드려요)

Copy link
Contributor Author

@TaehyeonPark TaehyeonPark Sep 10, 2024

Choose a reason for hiding this comment

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

저희 quest 중에서 invitor의 userOid를 받아서 처리해야하는 부분이 있는데, req에는 아마 client의 userOid 값만 있어서 구분을 위해서는 userId parameter가 필요해보여요!

  • src/lottery/services/globalState.js [line: 136--147]

image

*/
const eventValidator = async (req, res, next) => {
try {
const eventStatus = await eventStatusModel
Copy link
Member

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번 발생하게 됩니다.

Copy link
Member

Choose a reason for hiding this comment

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

다른 백엔드 분들은 어케 생각하시는지도 궁금하네요!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

계속 사용하는 것으로 결정

@TaehyeonPark TaehyeonPark changed the title Add: add ban features into event code #541 24-chuseok event ban middleware Sep 9, 2024
@TaehyeonPark TaehyeonPark reopened this Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

24-chuseok event ban middleware
2 participants