Skip to content

Conversation

@hisonghy
Copy link
Contributor

📌 작업 내용 및 특이사항

✅ 스탬프 순서 지정 방식 변경

  • 스탬프를 생성할 때 순서를 지정하는 방법을
    클라이언트에서 order 계산 후 요청, 서버에서 order 검증 -> 서버에서 특정 여행의 마지막 스탬프 order 값을 추출해 지정하는 방법으로 변경했습니다.

[ 리팩토링 전 ]

1. 스탬프 생성 요청 시 클라이언트에서 order 요청
2. 여행의 카테고리(코스/탐험)에 따라 order 검증
3. 검증에 성공하면 order 반영

[ 리팩토링 후 ]

1. 스탬프 생성 시 name, end_date 필드만 요청
2. 여행의 카테고리(코스/탐험) 판단
3. 코스형 여행일 경우, 해당 여행에 속한 스탬프 중 마지막 order를 추출해 +1 한 값으로 stamp_order 지정하고 스탬프 생성
5. 탐험형 여행일 경우, stamp_order를 0으로 지정하고 스탬프 생성
  • 스탬프 생성 CreateStampRequest DTO에서 order 필드를 제거했습니다.
  • 특정 여행의 스탬프 중 마지막 순서를 추출하는 findMaxStampOrderByTripId() 쿼리 메서드를 추가했습니다.
  • 새로운 스탬프를 생성할 때 먼저 여행의 카테고리를 비교하고, stamp_order 필드에 코스형 여행일 경우에는 findMaxStampOrderByTripId() + 1 값을, 탐험형 여행일 경우에는 0을 지정해 스탬프를 생성하도록 구현했습니다.
  • 기존 클라이언트로부터 요청받은 order 값을 검증하는 StampPolicy.validateStampOrder 메서드를 제거했습니다.
    서버에서 검증된 순서를 지정하고 직접 순서를 계산/추출하기때문에 검증까지 수행하지 않도록 구성했습니다.
  • 단일 스탬프 생성(StampCommandService.createStamp) 로직과 다중 스탬프 생성(StampCommandService.createStamps) 모두 변경사항을 반영했습니다.

✅ 관련 테스트 코드 수정

  • StampControllerIntegrationTest에서 단일 스탬프 생성 테스트 코드의 스탬프 순서 관련 예외 반환 테스트를 제거했습니다.
  • StampCommandServiceTest에서 단일 스탬프 생성, 다중 스탬프 생성 테스트 코드를 로직 변경에 맞게 수정했습니다.
  • TripControllerIntegrationTest에서 여행 생성 테스트 코드의 스탬프 순서 관련 예외 반환 테스트를 제거했습니다.
  • Stamp Fixture 클래스에서 order 관련 변경사항을 적용했습니다.

🌱 관련 이슈


🔍 참고사항(선택)


📚 기타(선택)

@hisonghy hisonghy self-assigned this Oct 16, 2025
@hisonghy hisonghy added ✨feature 구현, 개선 사항 관련 부분 🪄refactor 기능 개선 및 리팩토링 labels Oct 16, 2025
@hisonghy hisonghy force-pushed the refactor/88 branch 2 times, most recently from f6c205c to 960a127 Compare October 16, 2025 17:30
* refactor: CreateStampRequest DTO order 필드 제거

* feat: 특정 여행에 속한 스탬프의 마지막 순서를 조회하는 findMaxStampOrderByTripId 쿼리 추가

* refactor: 스탬프 생성(StampCommandService.createStamp) 로직 리팩토링
* refactor: 다중 스탬프 생성(StampCommondService.createStamps) 로직 리팩토링

* refactor: 스탬프 순서 검증(StampPolicy.validateStampOrder) 제거

* test: 스탬프 생성, 다중 스탬프 생성 단위 테스트 수정
* test: 여행 생성 통합 테스트 수정
* test: 스탬프 Fixture 클래스 수정
Copy link
Contributor

@chaiminwoo0223 chaiminwoo0223 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다. 머지 부탁드립니다!

@hisonghy hisonghy merged commit 2f0e0a6 into develop Oct 17, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✨feature 구현, 개선 사항 관련 부분 🪄refactor 기능 개선 및 리팩토링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🪄[REFACTOR]: 스탬프 순서 저장 방식 리팩토링

3 participants