Skip to content

Conversation

@ki-met-hoon
Copy link
Collaborator

@ki-met-hoon ki-met-hoon commented Jan 28, 2025

Pull request

Related issue

Resolve #74
Resolve #75
Resolve #76
Resolve #77

Motivation and context

  • 로컬 환경에서 Docker를 이용해 MongoDB를 생성했습니다.
    image |
image
  • 캔들차트 과거 데이터 조회 시 페이징 처리를 통해 클라이언트가 유동적으로 데이터를 응답 받도록 구현했습니다.
  • 한국 투자 API 응답의 snake_case 처리를 위해 FeignConfig의 ObjectMapper 설정을 사용했으나, 이는 의도치 않게 모든 JSON 응답에 영향을 미쳤습니다. 이 문제를 해결하기 위해 ObjectMapper 설정을 제거하고, 해당 DTO에만 @JsonNaming 어노테이션을 적용하여 지역적으로 처리하도록 변경했습니다.
  • 주식 종목 코드로 종목명을 조회하기 위해, Enum 순회 대신 Map을 활용해 O(1) 시간 복잡도로 조회하도록 구현했습니다. 현재는 영향이 미미하지만 확장성을 고려했습니다.
  • MinutePrice Document code field에 index를 추가해 조회 성능을 높혔습니다.

Solution

How has this been tested

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.

- MinutePriceSimpleResponse -> MinutePrice
- minutePriceRepository.save method 추가
- MinutePriceSimpleResponse DTO to Document 로직 추가
- 클라이언트에게 받은 code를 통해 이름을 얻기 위한 로직
- 반복문을 통해 enum 값을 조회할 수 있지만 확장성을 고려해 시간 복잡도를 최소화
- MongoDB insert 시 자동 생성되는 _class field 삭제 로직
- MSA 관점에서 Java class 정보인 _class 필드는 다양한 언어의 독립성 보장 X / 불필요한 메타 데이터
- 한국 투자 API로부터 받은 JSON 데이터가 SNAKE_CASE
- 이를 위해 objectMapper 구현
- objectMapper로 인해 다른 API 응답 형식이 SNAKE_CASE
- objectMapper 삭제 후 DTO @JsonNaming 추가
@ki-met-hoon ki-met-hoon added ✨ Feature 기능 추가 🎮 BE 백엔드 무조건 스프린트내에 해야하는 것들 labels Jan 28, 2025
@ki-met-hoon ki-met-hoon self-assigned this Jan 28, 2025
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.

고생하셨습니다! 작업량이 많아 고생하셨겠어요 ㅠㅠ 다만 저희가 한 이슈당 한 pr 작업을 하기로 했으니 나눠서 하는건 어떨까요? 이번꺼는 몽고디비 셋팅이랑 같이 들어가서 애매하셨을 것 같아요! 74~6, 77 이런식으로라도 다음엔 지켜주시면 좋을 것 같습니다!

Comment on lines 9 to 12
mongodb:
port: 27017
host: localhost
database: c_shape
Copy link
Member

Choose a reason for hiding this comment

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

배포시에 관리하기 위해서 여기도 env 변수명 처리해주시면 좋을 것 같아요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

수정해서 머지 하겠습니다!
말씀대로 몽고디비 셋팅이 들어가서 애매했던 부분이 있었습니다. 다음부터는 나눠서 진행하겠습니다!

@ki-met-hoon ki-met-hoon merged commit ba2409c into dev Jan 29, 2025
1 check failed
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.

캔들차트 과거 데이터 조회 API 구현 1분봉 데이터 DB 저장 로직 구현 주식 서버와 MongoDB 연결 MongoDB 생성

3 participants