Skip to content

[오하영] Sprint 11#49

Merged
reach0908 merged 8 commits intocodeit-sprint-fullstack:express-오하영from
fiivxyxxng:express-오하영
Jun 18, 2025

Hidden character warning

The head ref may contain hidden characters: "express-\uc624\ud558\uc601"
Merged

[오하영] Sprint 11#49
reach0908 merged 8 commits intocodeit-sprint-fullstack:express-오하영from
fiivxyxxng:express-오하영

Conversation

@fiivxyxxng
Copy link
Collaborator

요구사항

기본

공통

  • Github에 위클리 미션 PR을 만들어 주세요.
  • React 및 Express를 사용해 진행합니다.
  • TypeScript를 활용해 프로젝트의 필요한 곳에 타입을 명시해 주세요.
  • any 타입의 사용은 최소화해 주세요.
  • 복잡한 객체 구조나 배열 구조를 가진 변수에 인터페이스 또는 타입 별칭을 사용하세요.
  • Union, Intersection, Generics 등 고급 타입을 적극적으로 사용해 주세요.
  • 타입 별칭 또는 유틸리티 타입을 사용해 타입 복잡성을 줄여주세요.
  • 타입스크립트 컴파일러가 에러 없이 정상적으로 작동해야 합니다.

백엔드

  • 기존 Express.js 프로젝트를 타입스크립트 프로젝트로 마이그레이션 해주세요.
  • tsconfig.json 파일을 생성하고, 필요한 컴파일러 옵션을 설정해야 합니다. (예: outDir).
  • TypeScript 관련 명령어를 package.json에 설정해 주세요. (예: 빌드 및 개발 서버 실행 명령어).
  • ts-node와 nodemon을 사용하여 개발 환경을 구성합니다.
    • nodemon과 함께 ts-node를 사용하여 . ts 파일이 변경될 때 서버를 자동으로 재시작하도록 설정합니다.
  • Mongoose나 Prisma 등 ORM을 사용하는 경우, 모델에 대한 인터페이스 또는 타입을 정의합니다.
  • 필요한 경우, declare를 사용하여 타입을 오버라이드하거나 확장합니다.

주요 변경사항

스크린샷

image

멘토에게

  • 셀프 코드 리뷰를 통해 질문 이어가겠습니다.

Copy link

@reach0908 reach0908 left a comment

Choose a reason for hiding this comment

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

고생많으셨습니다!


async function save(data, ownerId) {
async function save(
data: Pick<Product, "images" | "tags" | "price" | "description" | "name">,

Choose a reason for hiding this comment

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

[P1]
이렇게 Pick할 필드가 많아지고 해당 타입이 중복되어 사용된다면 위에 ProductDataType과 같이 별도로 선언을 하는 방식으로 하면 재사용성이 좋아집니다.

Comment on lines +20 to +23
verifyAccessToken,
articleValidator,
validator,
createArticle

Choose a reason for hiding this comment

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

[P0]
미들웨어는 미들웨어, 컨트롤러는 컨트롤러 라고 명시적으로 네이밍을 하면 훨씬 가독성이 좋아질 것 같습니다.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

verifyAccessTokenMiddleware,
articleValidatorMiddleware,
createArticleController

이런식으로 파일명 뿐만 아니라 함수 이름에도 역할을 명시하란 말씀이신가요?

Comment on lines 14 to 16
const path = `${req.protocol}://${req.get("host")}/image/${
req.file.filename
req.file?.filename
}`;

Choose a reason for hiding this comment

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

[P0]
이렇게 하면 path에 undefined 가 들어갈 것 같습니다. file name이 없는 경우에는 다른 예외처리를 해야하지않을까요?

Comment on lines +1 to +27
export const ExceptionMessage = {
// Not Found
PRODUCT_NOT_FOUND: "상품을 찾을 수 없습니다.",
ARTICLE_NOT_FOUND: "게시글을 찾을 수 없습니다.",
COMMENT_NOT_FOUND: "댓글을 찾을 수 없습니다.",
USER_NOT_FOUND: "사용자를 찾을 수 없습니다.",
ACCESSTOKEN_NOT_FOUND: "accessToken을 찾을 수 없습니다.",
REFRESHTOKEN_NOT_FOUND: "refreshToken을 찾을 수 없습니다.",

// Not Match
PASSWORD_NOT_MATCH: "비밀번호가 일치하지 않습니다.",
PASSWORD_CONFIRMATION_NOT_MATCH: "비밀번호 확인이 일치하지 않습니다.",

// Already Exist
ALREADY_EXIST_EMAIL: "이미 사용중인 이메일입니다.",
ALREADY_EXIST_NICKNAME: "이미 사용중인 닉네임입니다.",

// Invalid
INVALID_EMAIL: "잘못된 이메일입니다.",
INVALID_INPUT: "필수 정보를 모두 입력해주세요.",
INVALID_ACCESS_TOKEN: "유효하지 않은 accessToken 입니다.",
INVALID_REFRESH_TOKEN: "유효하지 않은 refresh Token 입니다.",

UNAUTHORIZED: "인증되지 않은 사용자입니다.",
FORBIDDEN: "요청한 작업을 수행하기 위한 권한이 없습니다.",
GOOGLE_LOGIN_FAILED: "구글 로그인에 실패하였습니다.",
};

Choose a reason for hiding this comment

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

Good!

@reach0908 reach0908 merged commit 508d069 into codeit-sprint-fullstack:express-오하영 Jun 18, 2025
1 check passed
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.

2 participants