-
Notifications
You must be signed in to change notification settings - Fork 26
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
Feature/seunghun step3 #18
Open
seungh1024
wants to merge
17
commits into
base/seunghun
Choose a base branch
from
feature/seunghun_step3
base: base/seunghun
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 정산 정보를 한 번에 저장하여 관리하기 위해 mongoDB 사용 - n명의 정산 정보를 관계를 맺어 저장하면 저장할 레코드가 증가하는 문제 - 조회 시 조인이 필수적이므로 mongoDB에 n명의 정보를 배열 형태로 저장 - 전체 금액을 n으로 나눈 몫을 공평하게 가져가고, 나머지는 랜덤으로 1원씩 추가로 할당하여 정산
- 일정 금액은 기본 값으로 가지고 나머지 금액을 SecureRandom을 통해 랜덤으로 나눠줍니다. - 금액 차이가 크게 나지 않게 랜덤으로 나누고 싶었지만 마음대로 되지 않았습니다.
- 각각의 컨트롤러로 처리하던 1/n 정산과 랜덤 정산을 하나의 API에서 처리하도록 변경 - 정산 과정에서 중복되는 메소드를 하나로 합치고 1/n, 랜덤 기능만 별도의 메소드로 분리하여 처리
- MySQL과 MongoDB의 설정 파일을 별도로 작성 - 설정 파일로 인한 테이블 이름 인식 불가로 Entity에 테이블 이름 명시
- 최소 100원 단위로 정산하도록 변경 - 기존 복잡하던 계산 로직을 단순하게 변경
- Profile 설정으로 테스트 환경에서 불필요한 Config 파일 분리 - 코드 실행과 DB에 필요한 환경 변수 주입 타이밍이 맞지 않아 @DynamicPropertySource로 맞춰줌 - 독립된 환경으로 테스트 컨테이너를 실행하기 위해 @DirtiesContext로 Spring Context 분리
- ObjectId 기반으로 페이징 처리하도록 쿼리 변경 - ObjectId가 timestamp와 date 기반이라서 ObjectId 기반으로 페이징 처리를 해도 된다고 생각함
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MongoDB 사용
정산 기능
정산 내역 조회