Skip to content

Conversation

@ki-met-hoon
Copy link
Collaborator

@ki-met-hoon ki-met-hoon commented Feb 9, 2025

Pull request

Related issue

Resolve #116
Resolve #163

Motivation and context

  • 기존 페이지 기반 기능을 커서 기반 기능으로 리팩토링
  • 발생할 수 있는 예외들에 관한 처리 로직 구현

Solution

  • CandlePriceHistoryResponse DTO totalCount 삭제, hasNext, lastObjectId 변수 추가
    • hasNext는 뒤에 남은 데이터가 존재하는 지 여부
    • lastObjectId는 클라이언트에게 전달한 마지막 데이터의 ObjectId
  • 첫 요청과 추후 요청 구분해서 진행
    • findByCodeOrderByMinutePriceIdAsc는 첫 페이지 조회 시 클라이언트가 요청한 size만큼의 데이터 전달
    • findByCodeAndMinutePriceIdGreaterThanOrderByMinutePriceIdAsc는 클라이언트가 요청한 마지막 ObjectId부터 size만큼의 데이터를 가져옴
  • 데이터 조회 시 Size+1 조회
    • 조회 후 minutePriceChart가 size 이하라면 남은 데이터가 없음 즉, 모든 데이터 조회 완료
    • 아니라면 size 만큼의 데이터 제공
  • ControllerAdvice class 구현
    • InvalidObjectIdFormatException 구현
    • NoSuchMinutePriceException 구현
  • MinutePrice Document 네이밍 전략 변경
    • 작은 이슈라 해당 PR에 붙여서 진행

How has this been tested

image image image

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the docs/CONTRIBUTING.md document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

- findByCodeOrderByMinutePriceIdAsc는 첫 페이지 조회 시 클라이언트가 요청한 size만큼의 데이터 전달
…eIdAsc method 구현

- findByCodeAndMinutePriceIdGreaterThanOrderByMinutePriceIdAsc는 클라이언트가 요청한 마지막 ObjectId부터 size만큼의 데이터를 가져옴
- totalCount, Page 삭제
- hasNext, lastObjectId 추가
- Page type -> List type, hasNext, lastObjectId 파라미터 추가
- hasNext는 뒤에 남은 데이터가 존재하는 지 여부
- lastObjectId는 클라이언트에게 전달한 마지막 데이터의 ObjectId
-  첫 과거 데이터 요청의 경우
- 이미 한 번 이상 과거 데이터를 요청 받은 경우
- 과거 데이터 요청 유형 구분 method
- 처음인지 아닌지
- 데이터 조회 시 Size+1 조회
- 조회 후 minutePriceChart가 size 이하라면 남은 데이터가 없음 즉, 모든 데이터 조회 완료
- 아니라면 size 만큼의 데이터 제공
- List empty 예외 처리
- size 기본 값 120
- cursorId null 허용
@ki-met-hoon ki-met-hoon added ✨ Feature 기능 추가 🎮 BE 백엔드 무조건 스프린트내에 해야하는 것들 labels Feb 9, 2025
@ki-met-hoon ki-met-hoon added this to the 주톡피아 마일스톤2 milestone Feb 9, 2025
@ki-met-hoon ki-met-hoon self-assigned this Feb 9, 2025
@vercel
Copy link

vercel bot commented Feb 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
c-sharp ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 9, 2025 0:27am

@netlify
Copy link

netlify bot commented Feb 9, 2025

Deploy Preview for jootalkpia canceled.

Name Link
🔨 Latest commit 29dd219
🔍 Latest deploy log https://app.netlify.com/sites/jootalkpia/deploys/67a89f17c6732400081c6289

- collection은 snake case
- field는 camel case
@bo-ram-bo-ram
Copy link
Member

에러 발생시 커스텀 에러코드 같이 발생시켜주세요! 주식서버니까 S40001 형식이면 좋을 것 같습니다

Copy link
Member

@bo-ram-bo-ram bo-ram-bo-ram left a comment

Choose a reason for hiding this comment

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

swagger 구현도 필요해보입니다!

@ki-met-hoon ki-met-hoon merged commit 513a7e7 into dev Feb 10, 2025
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨ Feature 기능 추가 무조건 스프린트내에 해야하는 것들 🎮 BE 백엔드

Projects

None yet

Development

Successfully merging this pull request may close these issues.

캔들 차트 저장 Collection MongoDB 네이밍 전략에 맞춰 변경 주식 서버 커서 기반 페이징 리팩토링

3 participants