Skip to content

Conversation

@gustj3104
Copy link
Contributor

@gustj3104 gustj3104 commented Dec 31, 2025

📄 작업 내용

  • User와 생애주기는 동일하고, 하위 애그리거트의 동일 바운디드 컨텍스트로 속하도록 구현했습니다.
  • User의 auth도 user의 하위 애그리거트로 두고 별도의 바운디드 컨텍스트에 속하도록 디렉터리 구조를 수정했습니다!

설문 기능을 추가했습니다.

  • 회원 설문 저장
  • 회원 설문 조회

🙋🏻 이슈 / 궁금증 / 추가사항

방문 장소를 여러 개 입력받을 수 있게 되어있어서 @ElementCollection으로 별도의 테이블에 저장하도록 구현했는데,
단순 저장, 조회만 하는 경우라면 단일 컬럼에 장소를 저장하는 게 나을까요?

gustj3104 and others added 5 commits December 30, 2025 22:33
* feat: pkg 디렉토리로 감싸도록 수정 및 API 구현

* refactor: 패키지 조회 무한 스크롤 방식으로 수정

* feat: 상품 이미지 추가 구현

* refactor: 스웨거 설명 변경

* refactor: 반환자 변경
* feat: 장소 도메인 설계

* feat: 장소 생성, 수정 기능 구현

* fix: Jpa 필드명 수정

* fix: 디렉터리명 수정

* feat: 테스트 코드 구현

* feat: pkg 디렉토리로 감싸도록 수정 및 API 구현

* refactor: 패키지 조회 무한 스크롤 방식으로 수정

* feat: 상품 이미지 추가 구현

* refactor: 스웨거 설명 변경

* feat: 패키지 이벤트 추가

* fix: replace -> update로 수정

* fix: location test 메서드명 수정

* refactor: payload 구조로 변경

---------

Co-authored-by: sosow0212 <[email protected]>
@gustj3104 gustj3104 requested a review from sosow0212 December 31, 2025 14:40
@gustj3104 gustj3104 self-assigned this Dec 31, 2025
@gustj3104 gustj3104 added the feat 기능 추가 label Dec 31, 2025
@gustj3104 gustj3104 linked an issue Dec 31, 2025 that may be closed by this pull request
Copy link
Contributor

@sosow0212 sosow0212 left a comment

Choose a reason for hiding this comment

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

작업하신 거에 큰 이견 없습니다~ 수고하셨습니다👍 현재 패키지 구조가 꼬인게 있는 것 같은데 이건 차주에 모든 작업 마치고 한 번에 정리할게요!

Comment on lines 19 to 25
fun findUserSurvey(userId: Long): UserSurveyResponse {
val survey = userSurveyRepository.findByUserId(userId)
?: throw IllegalArgumentException("UserSurvey does not exist.")

return UserSurveyResponse.from(survey)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

이건 조회용으로 보여서 QueryService로 가는게 좋아보입니다!
현재 커맨드 서비스에서 사용한다면, private fun으로 만들어주세요

import org.springframework.data.jpa.repository.JpaRepository

interface UserSurveyJpaRepository: JpaRepository<UserSurvey, Long> {
fun findByUserId(userId: Long): UserSurvey?
Copy link
Contributor

Choose a reason for hiding this comment

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

코틀린 jpa에서는 findByIdOrNull 이라는 확장함수도 제공하는데 한 번 봐보시면 도움 되실 것 같아요~

Copy link
Contributor Author

Choose a reason for hiding this comment

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

설문은 회원당 1개만 존재하고, @LoginUser로 사용자를 식별하면 호출부가 단순해져서 조회할 때 surveyId가 아니라 userId로 구현한 상태예요. Repository에서도 findById가 아니라 findByUserId로 Survey를 조회하고 있는데, surveyId를 받아서 조회하는 게 좋을까요?

Copy link
Contributor

Choose a reason for hiding this comment

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

아아 이해했습니다~ 어차피 user랑 survey는 1:1이니 그대로 두셔도 될 거 같아요 (인덱스만 잘 걸어주세요!)

Comment on lines +32 to +38
@ElementCollection
@CollectionTable(
name = "user_survey_places",
joinColumns = [JoinColumn(name = "user_survey_id")]
)
@Column(name = "place", nullable = false, length = 100)
val places: List<String>
Copy link
Contributor

Choose a reason for hiding this comment

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

사전 위치 기반으로 데이터를 제공해준다면, 해당 정보가 필요할 거 같은데 조회할 때 복잡한 요구사항은 없을 것 같아서 지금 구조도 괜찮아 보입니다! 나중에 위치 데이터를 복잡하게 다룬다면 그때 개선하는 걸로 하시죠!!

@gustj3104 gustj3104 merged commit 7ba8fb8 into develop Jan 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat 기능 추가

Projects

None yet

Development

Successfully merging this pull request may close these issues.

회원 설문 도메인, API 구현

3 participants