Skip to content

#541 24년도 추석 이벤트 밴 미들웨어 #544

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

Open
wants to merge 11 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.

수고하셨습니다! 코멘트 확인 부탁드려요

@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
@Halo-sparcs Halo-sparcs changed the title #541 24-chuseok event ban middleware #541 24년도 추석 이벤트 밴 미들웨어 Mar 25, 2025
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.

작업 고생하셨습니다! 코멘트 확인 부탁드려요..!

@@ -17,6 +17,7 @@ import {
originValidatorMiddleware,
responseTimeMiddleware,
sessionMiddleware,
banMiddleware,
Copy link
Member

Choose a reason for hiding this comment

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

import를 지금 알파벳 순서로 맞춰놨는데, 요거에 맞춰주시면 좋을 것 같아요! (prettier에 import 자동 정렬을 넣으면 좋겠군요)

@@ -78,14 +79,15 @@ app.use(limitRateMiddleware);
// [Router] Swagger (API 문서)
app.use("/docs", docsRouter);

// [Middleware] 모든 API 요청에 대하여 origin 검증
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
Member

Choose a reason for hiding this comment

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

TS로 마이그레이션 완료되었으니 이 JS 파일은 삭제하면 될 것 같습니다.

@@ -0,0 +1,37 @@
import type { RequestHandler } from "express";
import { eventStatusModel } from "../modules/stores/mongo";
import logger from "../../modules/logger";
Copy link
Member

Choose a reason for hiding this comment

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

이런 경우에는 @/modules/logger 로 간단하게 import할 수 있어요!

* 사용자가 차단 되었는지 여부를 판단합니다.
* 차단된 사용자는 이벤트에 한하여 서비스 이용에 제재를 받습니다.
*
* @param req eventStatus가 성공적일 경우 req.eventStatus = eventStatus로 들어갑니다.
Copy link
Member

Choose a reason for hiding this comment

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

사소한건데.. 여기 공백이 2개 있습니다 ㅋㅋㅋㅋㅋ ㅠ

try {
// 이벤트(2025spring) 기간을 하루 더 연장하여 넙죽코인 소비기한을 보장할 때, completeQuest 함수를 비활성화합니다.
// 추후 이벤트에서는 아래 코드를 지워주시길 바랍니다.
if (timestamp >= new Date("2025-03-13T00:00:00+09:00")) return null;

// 1단계: 유저의 EventStatus를 가져옵니다. 블록드리스트인지도 확인합니다.
const eventStatus = await eventStatusModel.findOne({ userId }).lean();
if (!eventStatus || eventStatus.isBanned) return null;

if (!eventStatus) return null; //
Copy link
Member

Choose a reason for hiding this comment

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

!

@@ -13,7 +13,8 @@ router.get(

// 아래의 Endpoint 접근 시 로그인, 차단 여부 및 시각 체크 필요
router.use(require("../../middlewares/auth").default);
router.use(require("../middlewares/checkBanned"));
router.use(require("../../middlewares/ban").default);
Copy link
Member

Choose a reason for hiding this comment

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

저희 ban 미들웨어가 index.ts 파일에 달려있어서, 이런 곳에선 use 안해주셔도 됩니다!

@@ -15,7 +15,7 @@ const searchInviterHandler = async (req, res) => {
.lean();
if (
!inviterStatus ||
inviterStatus.isBanned ||
// !!banErrorMessage ||
Copy link
Member

Choose a reason for hiding this comment

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

!

Comment on lines +36 to +40
session: {
loginInfo: {
sid: testUser1.id,
},
},
Copy link
Member

Choose a reason for hiding this comment

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

이제 sid가 필요 없을 것 같은데, 이 부분은 삭제해도 될 것 같아요.

import { validateServiceBanRecord } from "@/modules/ban";

const serviceMapper = new Map([
["/rooms/create", "service"],
["/rooms/join", "service"],
["/rooms/create", "service"], // checked
Copy link
Member

Choose a reason for hiding this comment

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

checked의 의미는 뭔가요?

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년도 추석 이벤트 밴 미들웨어
3 participants