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

🧼 clean: μ½”λ“œ 일관성 ν–₯상 #11

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Jo-Minseok
Copy link
Collaborator

@Jo-Minseok Jo-Minseok commented Jan 11, 2025

πŸ”¨ ν…ŒμŠ€ν¬

Redis Scan λ°˜ν™˜μ„ μ •μˆ˜λ‘œ λ°”κΎΈλ©΄ μ•ˆ λ˜λ‚˜?

  • Redis에 μ–΄λŠ μ •λ„μ˜ 데이터가 μ €μž₯λ˜μ–΄μžˆλŠ” 지 μ• ν”Œλ¦¬μΌ€μ΄μ…˜ λ‹¨μ—μ„œ 미리 νŒŒμ•…ν•  수 μ—†λ‹€.
  • JS의 μ΅œλŒ€ 숫자 λ²”μœ„λ₯Ό λ²—μ–΄λ‚˜λ²„λ¦¬λ©΄ μ„œλΉ„μŠ€ μ˜ˆμ™Έκ°€ λ°œμƒν•œλ‹€.
  • JS의 μ΅œλŒ€ 숫자 λ²”μœ„ 9007199254740991 만큼 개수 λ²”μœ„κ°€ ν¬μ§€λŠ” μ•Šκ² μ§€λ§Œ μ‹œμŠ€ν…œ μ•ˆμ •μ„±μ„ μœ„ν•΄ λ¬Έμžμ—΄λ‘œ λ°˜ν™˜ν•˜λ„λ‘ 처리

λ‹€μŒ μž‘μ—… μˆ˜ν–‰ λͺ©λ‘ (PR룰에 따라 뢄리)

  1. Repository ν•¨μˆ˜ μž¬μ‚¬μš©ν•˜κ²Œ λ³€κ²½
  2. Swagger 처리 λΆ€λΆ„ λ³€κ²½
    • Swagger Request Example api-docs.ts -> DTO둜 λ³€κ²½
      • μž‘μ—… μ‚¬μœ : ν˜„μž¬ μƒˆλ‘œμš΄ API μƒμ„±μ‹œ api-docs.ts에 μˆ˜λ™μœΌλ‘œ API Request DTO의 속성듀을 λ“±λ‘ν•˜λŠ” λͺ‡λͺ‡ 뢀뢄듀이 있음. Request DTOλ₯Ό 생성할 λ•Œ, ApiPropertyλ₯Ό μ‚¬μš©ν•΄μ„œ μžλ™μœΌλ‘œ μ—°λ™λ˜λ„λ‘ ν•˜λŠ” 게 νŽΈν• λ“― 함
    • Swagger Response Example DTO둜 λ³€κ²½ ν•˜λŠ₯ ν•˜λ‹€λ©΄ λ³€κ²½
      • μž‘μ—… μ‚¬μœ : μœ„μ™€ 동일

μž‘μ—… μ‚¬μœ 

  • μ½”λ“œλŠ” μ—¬λŸ¬ λͺ…이 μ μ—ˆλ‹€ ν•œλ“€ ν•˜λ‚˜μ˜ ν”„λ‘œμ νŠΈ 내뢀라면 μ½”λ“œ ν˜•μ‹μ΄ λͺ¨λ‘ 동일해야 ν•œλ‹€κ³  νŒλ‹¨ν–ˆλ‹€.
  • μΆ”μƒμ μœΌλ‘œ μž‘μ„±λ˜μ–΄ μžˆλŠ” μ½”λ“œλ“€μ΄ λ§Žμ•„ λ‹€μ‹œ μ½”λ“œλ₯Ό 읽을 λ•Œ 이해 μ•ˆ λ˜λŠ” 뢀뢄이 μƒλ‹Ήνžˆ λ§Žμ•˜λ‹€.
  • λˆˆμ— κ±°μŠ¬λ¦¬λŠ” μ½”λ“œλ„ λ„ˆλ¬΄ λ§Žμ•˜κΈ°μ— μž‘μ—…μ„ μˆ˜ν–‰ν–ˆλ‹€.
  • μ •κ·œ ν”„λ‘œμ νŠΈ κΈ°κ°„μ—λŠ” 마감 일자둜 인해 촉박해져 막 μž‘μ—…ν•œ 뢀뢄이 κ½€ λ§Žμ•˜λ‹€.

πŸ“‹ μž‘μ—… λ‚΄μš©

  • νŒŒλΌλ―Έν„° DTO 적용 ν•˜μ—¬ κ°’ κ²€μ¦ν•˜κ²Œ λ³€κ²½

    • νŠΉμ • μ½”λ“œλŠ” νŒŒλΌλ―Έν„°λ₯Ό 직접 μΆ”μΆœν•˜λŠ” 방식이라 κ°’ 검증이 μ•ˆ λ˜λŠ” λ¬Έμ œκ°€ μžˆμ—ˆμŒ. μ½”λ“œ 톡일성을 μœ„ν•΄ DTO μΆ”κ°€
    @Params('feedId') params: Params

    λ³€κ²½

    @Params('feedId') params: FeedPaginationRequestDto
  • Validation μ½”λ“œ 정리, 제거

    • ν•„μš”μ—†λŠ” Validation λ°œκ²¬ν•˜μ—¬ 정리함, 라인도 정리
  • Controller 별도 data λ³€μˆ˜ μ—†μ• μ„œ μ½”λ“œ 톡일

    • λͺ‡λͺ‡ Controller μ½”λ“œμ—μ„œ 일관성이 λ§žμ§€ μ•ŠμŒμ„ 확인
    const data = μ„œλΉ„μŠ€ ν•¨μˆ˜();
    return ApiResponse.responseWithData('메세지',data);

    λ³€κ²½

    return ApiResponse.responseWithData('메세지',μ„œλΉ„μŠ€ ν•¨μˆ˜());
  • νŒŒλΌλ―Έν„° 별도 λ³€μˆ˜ 제거

    const { id } = params
    μ„œλΉ„μŠ€ ν•¨μˆ˜(id);

    λΆˆν•„μš”ν•˜κ²Œ id λ³€μˆ˜λ₯Ό μƒμ„±ν•˜λŠ” ꡬ문 제거

    μ„œλΉ„μŠ€ ν•¨μˆ˜(params.id);
  • Request Example 더미 λ°μ΄ν„°λ‘œ λ³€κ²½
    test 데이터가 μ•„λ‹Œ μž„μ‹œ 데이터가 λ“€μ–΄κ°€ μžˆλŠ” λΆ€λΆ„ λ³€κ²½

  • λ³€μˆ˜ 이름 result, item, data 처럼 좔상적인 λΆ€λΆ„ ꡬ체화
    map, filter 같이 κ³ μ°¨ ν•¨μˆ˜μ—μ„œ result, item, data와 같이 좔상적인 λ³€μˆ˜λͺ…μœΌλ‘œ 가독성이 λΆˆνŽΈν–ˆλ˜ λΆ€λΆ„ ꡬ체화λ₯Ό 톡해 κ°œμ„ 

@Jo-Minseok Jo-Minseok added the 🧹 Cleanup μ½”λ“œ 정리 label Jan 11, 2025
@Jo-Minseok Jo-Minseok self-assigned this Jan 11, 2025
@Jo-Minseok Jo-Minseok changed the title 🧼 clean: μ½”λ“œ 일관성, λ³€μˆ˜ 이름 λ³€κ²½ 🧼 clean: μ½”λ“œ 일관성 ν–₯상 Jan 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧹 Cleanup μ½”λ“œ 정리
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant