Skip to content
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

feat: 회원 상세 정보 저장 및 조회 구현 #9

Merged
merged 226 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 225 commits
Commits
Show all changes
226 commits
Select commit Hold shift + click to select a range
7d1e91a
feat: 프로필 속성 정의
devholic22 Feb 13, 2024
4117809
feat: 프로필 속성 정의
devholic22 Feb 13, 2024
208fd0e
refactor: 프로필 속성 구조 수정
devholic22 Feb 17, 2024
0d8e60b
refactor: 프로필 속성 구조 수정
devholic22 Feb 17, 2024
226ad3a
fix: 로그인 정보 식별 오류 수정
devholic22 Feb 20, 2024
bbd7b66
refactor: 클래스 경로 및 구조 수정
devholic22 Feb 20, 2024
4a84e31
feat: Repository 정의
devholic22 Feb 20, 2024
5e7cd52
feat: DTO 정의
devholic22 Feb 20, 2024
02a0cea
feat: 이벤트 처리 구현
devholic22 Feb 20, 2024
f439212
feat: InfoController 작성
devholic22 Feb 20, 2024
7b2af53
feat: InfoController 작성
devholic22 Feb 20, 2024
9fc8b60
Merge branch 'feat/7' of https://github.com/sosow0212/atwoz into feat/7
devholic22 Feb 20, 2024
d01bc01
fix: Hobbies, Styles 저장 오류 수정
devholic22 Feb 20, 2024
741d8aa
refactor: 공백 추가
devholic22 Feb 20, 2024
b206757
refactor: Hobbies, Styles 엔티티화 해제
devholic22 Feb 20, 2024
6fd0553
fix: Option, Profile 중복 저장 오류 해결
devholic22 Feb 20, 2024
18123be
refactor: MemberService 공통 축약
devholic22 Feb 20, 2024
4e3d4d1
refactor: Member id Column 속성 삭제
devholic22 Feb 20, 2024
db4e702
refactor: Member에서 Hobbies, Styles 삭제
devholic22 Feb 20, 2024
d7f3f93
refactor: 이벤트 시제 변경
devholic22 Feb 20, 2024
5ee2eba
refactor: MemberBody 수정
devholic22 Feb 20, 2024
1a7a8ff
refactor: Profile, Option 이벤트 핸들러 이름 변경
devholic22 Feb 20, 2024
8481b08
refactor: NullValueException 삭제
devholic22 Feb 21, 2024
8cb873b
refactor: 사이즈 0일 시 isEmpty 사용
devholic22 Feb 21, 2024
0b7d094
refactor: Repository 인터페이스 위치 수정
devholic22 Feb 21, 2024
e615cd4
refactor: Member - Hobby 구조 수정
devholic22 Feb 21, 2024
a77c05f
refactor: Member - Style 구조 수정
devholic22 Feb 21, 2024
014751a
fix: Option 수정 기능 오류 수정
devholic22 Feb 22, 2024
7e29a6d
feat: Position 추가
devholic22 Feb 22, 2024
504e59d
feat: 프로필 (Profile) 조회 작성
devholic22 Feb 22, 2024
d3b3ea9
feat: 옵션 (Option) 조회 작성
devholic22 Feb 22, 2024
a5705eb
refactor: OptionController 위치 수정
devholic22 Feb 22, 2024
fb28387
feat: 회원 취미 조회 작성
devholic22 Feb 22, 2024
47fa1a0
feat: 회원 스타일 조회 작성
devholic22 Feb 22, 2024
f6e5215
refactor: Body 생성 수정
devholic22 Feb 22, 2024
07f60d0
refactor: Profile 조회 시 이름 수정
devholic22 Feb 22, 2024
fdfb4d2
refactor: 중복 선택 예외처리 추가
devholic22 Feb 22, 2024
28e0570
test: HobbyName 테스트 작성
devholic22 Feb 22, 2024
1f61cf0
test: StyleName 테스트 작성
devholic22 Feb 22, 2024
be7ce4d
test: Gender 테스트 작성
devholic22 Feb 22, 2024
d7d79ab
test: BodyTest 작성
devholic22 Feb 22, 2024
9f7904d
test: Position 테스트 작성
devholic22 Feb 22, 2024
7a63627
test: ProfileJpaRepository 테스트 작성
devholic22 Feb 22, 2024
a2ef0d9
test: OptionJpaRepository 테스트 작성
devholic22 Feb 22, 2024
d9a5089
test: HobbyJpaRepository 테스트 작성
devholic22 Feb 23, 2024
f66f1f4
test: StyleJpaRepository 테스트 작성
devholic22 Feb 23, 2024
18db8df
test: HobbyService 테스트 작성
devholic22 Feb 23, 2024
e58e6b2
test: StyleService 테스트 작성
devholic22 Feb 23, 2024
7e62fb8
test: OptionService 테스트 작성
devholic22 Feb 23, 2024
5b70292
test: ProfileService 테스트 작성
devholic22 Feb 23, 2024
1e58309
test: OptionServiceTest 수정
devholic22 Feb 23, 2024
00da0ba
test: InfoService 테스트 작성
devholic22 Feb 23, 2024
ec7cde9
test: HobbyControllerWebMvc 테스트 작성
devholic22 Feb 23, 2024
c8c05a7
test: HobbyControllerWebMvc 수정
devholic22 Feb 23, 2024
f35e9c6
test: StyleControllerWebMvc 테스트 작성
devholic22 Feb 23, 2024
d1c3cb1
test: OptionControllerWebMvc 테스트 작성
devholic22 Feb 23, 2024
153bcb1
test: ProfileControllerWebMvc 테스트 작성
devholic22 Feb 23, 2024
8e53aef
test: InfoControllerWebMvc 테스트 작성
devholic22 Feb 23, 2024
381d8b5
refactor: 예외 핸들러에 추가
devholic22 Feb 23, 2024
f0fa2a9
docs: API 문서들에 HTTP request 추가
devholic22 Feb 23, 2024
d1a4d0c
refactor: DTO 인자 공백 삭제
devholic22 Feb 23, 2024
e0370d7
refactor: HobbyName 검증 메서드 분할
devholic22 Feb 23, 2024
5d70f1a
refactor: HobbyRepository final 인자 수정
devholic22 Feb 23, 2024
aabc021
refactor: OptionFactory 공백 삭제
devholic22 Feb 23, 2024
050ce6c
refactor: InfoController 공백 삭제
devholic22 Feb 23, 2024
1cc1470
refactor: HobbyJpaRepository final 인자 수정
devholic22 Feb 23, 2024
9e7c033
refactor: 컨트롤러 memberId final 인자 수정
devholic22 Feb 23, 2024
4bde570
refactor: Body 나이 계산 수정
devholic22 Feb 23, 2024
cb9188d
refactor: Option, Profile 메서드 인자 줄내림
devholic22 Feb 23, 2024
8310c83
refactor: 테스트 파일 public 제어자 삭제
devholic22 Feb 23, 2024
dd7cd0b
refactor: 서비스 테스트의 MockitoExtension 제거
devholic22 Feb 23, 2024
91465b0
refactor: InfoServiceTest 필드 제어자 추가
devholic22 Feb 23, 2024
34817bb
refactor: ProfileServiceTest 중복 검증 삭제
devholic22 Feb 23, 2024
5ca32b2
refactor: YearManager 패키지 위치 수정
devholic22 Feb 23, 2024
9dd50e9
refactor: HobbyName 조회 메서드명 수정
devholic22 Feb 23, 2024
c39a9f2
refactor: StyleName 조회 메서드명 수정
devholic22 Feb 23, 2024
abeb3ef
refactor: Position BigDecimal 교체
devholic22 Feb 23, 2024
b5e945b
refactor: ParseMemberIdFromTokenInterceptor url 수정
devholic22 Feb 23, 2024
88777a5
refactor: Option 존재 여부 메서드 성능 개선
devholic22 Feb 23, 2024
5194b38
refactor: Profile 존재 여부 메서드 성능 개선
devholic22 Feb 23, 2024
cf4c7e6
refactor: HobbyFakeRepository id 저장 수정
devholic22 Feb 24, 2024
79c79c5
refactor: StyleFakeRepository id 저장 수정
devholic22 Feb 24, 2024
c16341a
refactor: DTO 정적 팩터리 메서드 추가
devholic22 Feb 24, 2024
84f3006
refactor: DTO 정적 팩터리 메서드 추가
devholic22 Feb 24, 2024
41e30f7
refactor: MockBean 캐싱 처리 적용
devholic22 Feb 24, 2024
d6e166e
refactor: InfoService 메서드 분리
devholic22 Feb 24, 2024
b460eeb
refactor: MockBean 어노테이션 삭제
devholic22 Feb 24, 2024
31209e6
refactor: StyleControllerWebMvcTest 헤더 정보 추가
devholic22 Feb 24, 2024
e017194
refactor: ProfileControllerWebMvcTest 헤더 정보 추가
devholic22 Feb 24, 2024
b9d475a
refactor: OptionControllerWebMvcTest 헤더 정보 추가
devholic22 Feb 24, 2024
67ef079
refactor: InfoControllerWebMvcTest 헤더 정보 추가
devholic22 Feb 24, 2024
570f2f4
refactor: HobbyControllerWebMvcTest 헤더 정보 추가
devholic22 Feb 24, 2024
dfed61b
refactor: 하위 DTO들의 validation 적용
devholic22 Feb 24, 2024
976e410
refactor: OptionService 메서드 분리 해제
devholic22 Feb 24, 2024
f39669b
refactor: Hobby 코드 추가
devholic22 Feb 25, 2024
4eda5dd
refactor: Style 코드 추가
devholic22 Feb 25, 2024
2d84172
refactor: Job enum으로 변경
devholic22 Feb 25, 2024
551f0e3
refactor: Hobby 응답 코드로 수정
devholic22 Feb 25, 2024
2d961ce
refactor: Style 응답 코드로 수정
devholic22 Feb 25, 2024
56354cb
refactor: 값 범위 예외 분할
devholic22 Feb 25, 2024
bd9fa81
refactor: info 작성 상태 코드 변경
devholic22 Feb 25, 2024
d4fa067
refactor: InfoServiceTest beforeEach 삭제
devholic22 Feb 27, 2024
1d733d6
refactor: Factory 정적 클래스화
devholic22 Feb 27, 2024
439b19c
refactor: YearManager 생성자로 이동
devholic22 Feb 27, 2024
5f8aaa0
refactor: InfoService 메서드명 변경
devholic22 Feb 27, 2024
8263a1e
refactor: Hobby, Style 요청 이름 변경
devholic22 Feb 27, 2024
8cd2391
refactor: BodyFixture 변수 할당으로 수정
devholic22 Feb 27, 2024
3884a88
refactor: 테스트 데이터 Fixture 추가
devholic22 Feb 27, 2024
0fcd5f4
refactor: 테스트 데이터 Fixture 적용
devholic22 Feb 27, 2024
9864d37
refactor: Info 조회 모델 생성 (Querydsl)
devholic22 Feb 27, 2024
e46c0ce
refactor: Profile, Option 저장 값 비교 방식 수정
devholic22 Feb 27, 2024
a84e8f9
refactor: Image 삭제
devholic22 Feb 28, 2024
e59e03c
refactor: Hobby, HobbyName 이름 변경
devholic22 Feb 28, 2024
f532a38
refactor: InfoRepositoryImpl 용어 변경
devholic22 Feb 28, 2024
ae46225
refactor: PropertyNotFoundException 삭제
devholic22 Feb 28, 2024
24d33b6
refactor: Job 메서드, 예외 이름 수정
devholic22 Feb 28, 2024
43e3aca
refactor: Style, StyleName 이름 변경
devholic22 Feb 28, 2024
6bbdcb2
refactor: MemberStyle 인자 이름 변경
devholic22 Feb 28, 2024
737c4cb
refactor: Hobby, Style 조회 실패 예외 메서드명 변경
devholic22 Feb 28, 2024
9ee676d
refactor: InfoRepositoryImpl 용어 변경
devholic22 Feb 28, 2024
e5b20de
test: Drink 테스트 작성
devholic22 Feb 28, 2024
66ef872
test: Graduate 테스트 작성
devholic22 Feb 28, 2024
c483c34
test: Mbti 테스트 작성
devholic22 Feb 28, 2024
007cffc
test: Religion 테스트 작성
devholic22 Feb 28, 2024
b4c00f6
test: Smoke 테스트 작성
devholic22 Feb 28, 2024
869dabf
test: Profile 테스트 작성
devholic22 Feb 28, 2024
e3e3967
test: Option 테스트 작성
devholic22 Feb 28, 2024
bc7a3fd
refactor: MemberStyleJpaRepositoryTest 이름 수정
devholic22 Feb 28, 2024
ba3cc01
refactor: MemberStyleJpaRepositoryTest 변수 수정
devholic22 Feb 28, 2024
bcc9e29
refactor: MemberHobbyJpaRepositoryTest 변수 수정
devholic22 Feb 28, 2024
d2965cf
refactor: MemberHobbyFakeRepository 변수 수정
devholic22 Feb 28, 2024
00929b1
refactor: MemberStyleFakeRepository 변수 수정
devholic22 Feb 28, 2024
c3dbae3
refactor: ProfileJpaRepositoryTest ignoringFields 추가
devholic22 Feb 28, 2024
6a06503
refactor: OptionJpaRepositoryTest ignoringFields 추가
devholic22 Feb 28, 2024
c940570
refactor: Hobby 변수 및 메서드 수정
devholic22 Feb 28, 2024
f755d7f
refactor: Style 변수 및 메서드 수정
devholic22 Feb 28, 2024
6d99997
refactor: Enumerated 위치 수정
devholic22 Feb 28, 2024
3869917
refactor: NoArgsConstructor 위치 수정
devholic22 Feb 28, 2024
7e65680
refactor: exists 쿼리 성능 개선 적용
devholic22 Feb 28, 2024
bca409a
refactor: 이벤트 RequiredArgsConstructor 통일
devholic22 Feb 28, 2024
8582f6e
refactor: OptionEventHandler 공백 추가
devholic22 Feb 28, 2024
4a46263
refactor: Location, Position 표현 수정
devholic22 Feb 28, 2024
5b4bc02
refactor: ProfileFactory 공백 추가
devholic22 Feb 28, 2024
fced5f3
feat: info 수정 요청 DTO 정의
devholic22 Feb 28, 2024
8a2b93b
feat: info 수정 요청 이벤트 정의
devholic22 Feb 28, 2024
b27b398
feat: 스타일 수정 구현
devholic22 Feb 28, 2024
9901c37
refactor: StyleServiceTest 이름 변경
devholic22 Feb 28, 2024
0f4ee57
feat: 취미 수정 구현
devholic22 Feb 28, 2024
756fd8c
refactor: StyleService 이름 변경
devholic22 Feb 28, 2024
6a1d0ea
refactor: MemberHobbyServiceTest then 변수 위치 수정
devholic22 Feb 28, 2024
b7f5894
refactor: MemberStyleServiceTest 오타 수정
devholic22 Feb 28, 2024
8dfcf4d
feat: Option 수정 구현
devholic22 Feb 28, 2024
5cba3d3
feat: InfoService 수정 메서드 작성
devholic22 Feb 28, 2024
8f66dae
refactor: Fixture에 SuppressWarnings 추가
devholic22 Feb 28, 2024
616c472
refactor: HobbyInvalid 이름 수정
devholic22 Feb 28, 2024
f1e6f8f
refactor: DrinkInvalid 이름 수정
devholic22 Feb 28, 2024
d69db5c
refactor: 클래스 이름 수정
devholic22 Feb 28, 2024
84c2e61
refactor: MemberStyleRepository final 추가
devholic22 Feb 28, 2024
57303b2
refactor: PositionTest 인자 수정
devholic22 Feb 28, 2024
9c369dc
feat: InfoController 정보 수정 메서드 구현
devholic22 Feb 29, 2024
fca4ffb
refactor: StyleInvalid 이름 수정
devholic22 Feb 29, 2024
e916d1b
test: InfoServiceTest 정보 수정 테스트
devholic22 Feb 29, 2024
a9597b8
docs: InfoController 수정 response field 추가
devholic22 Feb 29, 2024
89b38c5
refactor: InfoControllerWebMvcTest Fixture 추가
devholic22 Feb 29, 2024
e2bc9bc
test: InfoServiceTest 조회 테스트 작성
devholic22 Feb 29, 2024
18b2041
refactor: ProfileServiceTest ignoringFields 추가
devholic22 Feb 29, 2024
73107c3
refactor: 인터페이스 인자 final 추가
devholic22 Feb 29, 2024
3612110
refactor: OptionFactory 메서드 통일
devholic22 Feb 29, 2024
9494c63
feat: ProfileService 수정 메서드 구현
devholic22 Feb 29, 2024
af7d92c
fix: ProfileEventHandler 서비스 호출 등록
devholic22 Feb 29, 2024
9a4eee7
refactor: OptionFactory request 추상화
devholic22 Feb 29, 2024
50612de
refactor: ProfileFactory request 추상화
devholic22 Feb 29, 2024
83241e1
fix: OptionRequest 구현체 DTO 기본 생성자 추가
devholic22 Feb 29, 2024
77dcc60
refactor: Request private 속성 추가
devholic22 Feb 29, 2024
989fffa
refactor: Job 조회 메서드명 수정
devholic22 Feb 29, 2024
8495097
refactor: HobbyJpaRepository 이름 수정
devholic22 Feb 29, 2024
3f77b04
refactor: Style 검증 코드 분할
devholic22 Feb 29, 2024
a961677
refactor: 응답 DTO 공백 추가
devholic22 Feb 29, 2024
9db6534
refactor: JpaRepositoryTest ignoringFields 추가
devholic22 Feb 29, 2024
2ff647c
fix: Style 검증 예외 수정
devholic22 Feb 29, 2024
5804df5
refactor: AllArgsConstructor access 단계 수정
devholic22 Feb 29, 2024
ccf0e67
refactor: ProfileServiceTest 예외 검증
devholic22 Feb 29, 2024
6e6998a
refactor: OptionServiceTest 예외 검증
devholic22 Feb 29, 2024
6bb85db
refactor: InfoService MockBeanInjection 이동
devholic22 Mar 1, 2024
cef5341
refactor: MemberRepository 의존 삭제
devholic22 Mar 1, 2024
b53a6d1
refactor: DTO 공백 삭제
devholic22 Mar 1, 2024
90d982f
refactor: Request DTO 인터페이스 삭제
devholic22 Mar 1, 2024
4c393ed
refactor: Q파일 static import 처리
devholic22 Mar 1, 2024
517401b
refactor: 테스트 용어 구분 추가
devholic22 Mar 1, 2024
64049be
test: InfoController 인수 테스트 작성
devholic22 Mar 1, 2024
35d1ec1
refactor: 테스트 메서드 수정
sosow0212 Mar 1, 2024
e1db46e
refactor: Profile, Option, MemberHobby, MemberStyle Fixture 작성
devholic22 Mar 1, 2024
cfff6cc
refactor: 인수 테스트 given Fixture 이용
devholic22 Mar 1, 2024
6e8bd28
refactor: 테스트 요청 Fixture 구조 수정
devholic22 Mar 1, 2024
1e41618
refactor: Querydsl 구현체 분리
devholic22 Mar 1, 2024
1efb1f6
refactor: MemberHobby, MemberStyle 삭제 쿼리 개선
devholic22 Mar 1, 2024
654235e
test: InfoController 인수 테스트 추가 작성
devholic22 Mar 1, 2024
d6eacb3
refactor: InfoSearchResponse 예외 이동
devholic22 Mar 2, 2024
c6b7147
refactor: InfoServiceTest 이벤트 mock 처리
devholic22 Mar 2, 2024
34f4d3f
refactor: 수정 테스트 시 리포지터리를 이용하도록 수정
devholic22 Mar 2, 2024
9b12d09
refactor: OptionFactory 제거
devholic22 Mar 2, 2024
6ad6749
refactor: Profile, Option 업데이트 방식 변경
devholic22 Mar 2, 2024
920fad8
refactor: Option 내부 DTO 생성
devholic22 Mar 2, 2024
3cf519b
refactor: ProfileFactory 삭제
devholic22 Mar 3, 2024
c9aae30
refactor: BodySearchResponseFixture 클래스로 복구
devholic22 Mar 3, 2024
087c304
refactor: Profile, Option 조인 조회 방식으로 수정
devholic22 Mar 3, 2024
dff9f00
refactor: 이벤트 패키지 수정
devholic22 Mar 3, 2024
b4777a8
refactor: DTO 패키지 수정
devholic22 Mar 3, 2024
9be88b7
refactor: 이벤트 패키지 위치 조정
devholic22 Mar 3, 2024
a0a1eff
refactor: 응답 DTO 위치 조정
devholic22 Mar 3, 2024
32a3fe7
refactor: Fixture 구조 수정
devholic22 Mar 3, 2024
0c8d4cf
refactor: InnerProfile DTO 위치 수정
devholic22 Mar 3, 2024
1308dc4
refactor: 서비스 테스트 패키지 수정
devholic22 Mar 3, 2024
10e2808
test: 취미 서비스 단계의 예외 검증 추가
devholic22 Mar 3, 2024
40e8796
test: 스타일 서비스 단계의 예외 검증 추가
devholic22 Mar 3, 2024
d64c1c2
refactor: 도메인 테스트 패키지 수정
devholic22 Mar 3, 2024
7fad512
refactor: JPA 리포지터리 메서드들이 명시되도록 수정
devholic22 Mar 3, 2024
0217c19
fix: findAll 메서드 재정의 삭제
devholic22 Mar 3, 2024
b5cb745
refactor: Fixture static import 추가
devholic22 Mar 3, 2024
a5cde12
test: InfoQueryRepository 테스트 추가
devholic22 Mar 3, 2024
1b23328
refactor: Job 예외 패키지 수정
devholic22 Mar 4, 2024
ded8bd8
refactor: Option, Body 정적 팩터리 메서드 수정
devholic22 Mar 4, 2024
b0433e0
refactor: InnerOptionUpdateRequest 공백 추가
devholic22 Mar 4, 2024
26513b3
refactor: Profile updateContents 삭제
devholic22 Mar 4, 2024
972ede0
refactor: InnerProfileUpdateRequest Fixture 추가
devholic22 Mar 4, 2024
7201923
refactor: InfoService 메서드 체이닝 최소화
devholic22 Mar 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions src/docs/asciidoc/info.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
:toc: left
:source-highlighter: highlightjs
:sectlinks:
:toclevels: 2
:sectlinks:
:sectnums:

== Info

=== 회원 정보 작성

==== 요청
include::{snippets}/info-controller-web-mvc-test/write_info/http-request.adoc[]
include::{snippets}/info-controller-web-mvc-test/write_info/request-headers.adoc[]
include::{snippets}/info-controller-web-mvc-test/write_info/request-fields.adoc[]

==== 응답
include::{snippets}/info-controller-web-mvc-test/write_info/http-response.adoc[]

=== 회원 정보 수정

==== 요청
include::{snippets}/info-controller-web-mvc-test/update_info/http-request.adoc[]
include::{snippets}/info-controller-web-mvc-test/update_info/request-headers.adoc[]
include::{snippets}/info-controller-web-mvc-test/update_info/request-fields.adoc[]

==== 응답
include::{snippets}/info-controller-web-mvc-test/update_info/http-response.adoc[]

=== 회원 정보 조회

==== 요청
include::{snippets}/info-controller-web-mvc-test/search_info/http-request.adoc[]
include::{snippets}/info-controller-web-mvc-test/search_info/request-headers.adoc[]
==== 응답
include::{snippets}/info-controller-web-mvc-test/search_info/http-response.adoc[]
include::{snippets}/info-controller-web-mvc-test/search_info/response-fields.adoc[]
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.Objects;

@Slf4j
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.atwoz.global.event.Events;
import com.atwoz.member.application.auth.dto.LoginRequest;
import com.atwoz.member.application.event.ValidatedLoginEvent;
import com.atwoz.member.application.auth.event.ValidatedLoginEvent;
import com.atwoz.member.domain.auth.TokenProvider;
import com.atwoz.member.infrastructure.auth.dto.MemberInfoResponse;
import com.atwoz.member.infrastructure.auth.dto.OAuthProviderRequest;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.atwoz.member.application.event;
package com.atwoz.member.application.auth.event;

import com.atwoz.global.event.Event;
import lombok.Getter;
Expand Down
89 changes: 89 additions & 0 deletions src/main/java/com/atwoz/member/application/info/InfoService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package com.atwoz.member.application.info;

import com.atwoz.global.event.Events;
import com.atwoz.member.application.info.hobby.event.HobbyUpdatedEvent;
import com.atwoz.member.application.info.hobby.event.HobbyWroteEvent;
import com.atwoz.member.application.info.option.event.OptionUpdatedEvent;
import com.atwoz.member.application.info.option.event.OptionWroteEvent;
import com.atwoz.member.application.info.profile.event.ProfileUpdatedEvent;
import com.atwoz.member.application.info.profile.event.ProfileWroteEvent;
import com.atwoz.member.application.info.style.event.StyleUpdatedEvent;
import com.atwoz.member.application.info.style.event.StyleWroteEvent;
import com.atwoz.member.application.info.hobby.dto.HobbyUpdateRequest;
import com.atwoz.member.application.info.hobby.dto.HobbyWriteRequest;
import com.atwoz.member.application.info.dto.InfoUpdateRequest;
import com.atwoz.member.application.info.dto.InfoWriteRequest;
import com.atwoz.member.application.info.style.dto.StyleUpdateRequest;
import com.atwoz.member.application.info.style.dto.StyleWriteRequest;
import com.atwoz.member.domain.info.InfoRepository;
import com.atwoz.member.exception.exceptions.info.InfoNotFoundException;
import com.atwoz.member.infrastructure.info.dto.InfoSearchResponse;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

@RequiredArgsConstructor
@Transactional(readOnly = true)
@Service
public class InfoService {

private final InfoRepository infoRepository;

@Transactional
public void writeInfo(final Long memberId, final InfoWriteRequest request) {
List<String> hobbyCodes = extractHobbyNamesFromInfoWriteRequest(request);
List<String> styleCodes = extractStyleNamesFromInfoWriteRequest(request);

Events.raise(new ProfileWroteEvent(memberId, request.profile()));
Events.raise(new OptionWroteEvent(memberId, request.option()));

Events.raise(new HobbyWroteEvent(memberId, hobbyCodes));
Events.raise(new StyleWroteEvent(memberId, styleCodes));
}

private List<String> extractHobbyNamesFromInfoWriteRequest(final InfoWriteRequest request) {
return request.hobbies()
.stream()
.map(HobbyWriteRequest::hobby)
.toList();
}

private List<String> extractStyleNamesFromInfoWriteRequest(final InfoWriteRequest request) {
return request.styles()
.stream()
.map(StyleWriteRequest::style)
.toList();
}
Copy link
Owner

Choose a reason for hiding this comment

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

request.styles().stream(), request.hobbies().stream()이 한 맥락인데 매개변수를 InfoWriteRequest로 받는 이유가 있나요?
한 줄에 체이닝을 한번 사용하기 위해 일부러 분리한 것 처럼 보이네요
request를 넘기지 말고 값을 꺼내서 넘기도록 수정해주세요~

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

값을 한번 꺼내서 넘기면 불필요한 체이닝을 제거할 수 있겠군요..! 수정 완료하였습니다 :)


@Transactional
public void updateInfo(final Long memberId, final InfoUpdateRequest request) {
List<String> hobbyCodes = extractHobbyNamesFromInfoUpdateRequest(request);
List<String> styleCodes = extractStyleNamesFromInfoUpdateRequest(request);

Events.raise(new ProfileUpdatedEvent(memberId, request.profile()));
Events.raise(new OptionUpdatedEvent(memberId, request.option()));

Events.raise(new HobbyUpdatedEvent(memberId, hobbyCodes));
Events.raise(new StyleUpdatedEvent(memberId, styleCodes));
}

private List<String> extractHobbyNamesFromInfoUpdateRequest(final InfoUpdateRequest request) {
return request.hobbies()
.stream()
.map(HobbyUpdateRequest::hobby)
.toList();
}

private List<String> extractStyleNamesFromInfoUpdateRequest(final InfoUpdateRequest request) {
return request.styles()
.stream()
.map(StyleUpdateRequest::style)
.toList();
}
Copy link
Owner

Choose a reason for hiding this comment

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

이것도 request 값 꺼내서 넘겨주세요~

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

수정하였습니다 :)


public InfoSearchResponse findInfo(final Long memberId) {
return infoRepository.findByMemberId(memberId)
.orElseThrow(InfoNotFoundException::new);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.atwoz.member.application.info.dto;

import com.atwoz.member.application.info.hobby.dto.HobbyUpdateRequest;
import com.atwoz.member.application.info.option.dto.OptionUpdateRequest;
import com.atwoz.member.application.info.profile.dto.ProfileUpdateRequest;
import com.atwoz.member.application.info.style.dto.StyleUpdateRequest;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;

public record InfoUpdateRequest(
@Valid
@NotNull(message = "profile 요청이 있어야 합니다.")
ProfileUpdateRequest profile,

@Valid
@NotNull(message = "option 요청이 있어야 합니다.")
OptionUpdateRequest option,

@Valid
@NotNull(message = "취미 요청이 있어야 합니다.")
List<HobbyUpdateRequest> hobbies,

@Valid
@NotNull(message = "스타일 요청이 있어야 합니다.")
List<StyleUpdateRequest> styles
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package com.atwoz.member.application.info.dto;

import com.atwoz.member.application.info.hobby.dto.HobbyWriteRequest;
import com.atwoz.member.application.info.option.dto.OptionWriteRequest;
import com.atwoz.member.application.info.profile.dto.ProfileWriteRequest;
import com.atwoz.member.application.info.style.dto.StyleWriteRequest;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import java.util.List;

public record InfoWriteRequest(
@Valid
@NotNull(message = "profile 요청이 있어야 합니다.")
ProfileWriteRequest profile,

@Valid
@NotNull(message = "option 요청이 있어야 합니다.")
OptionWriteRequest option,

@Valid
@NotNull(message = "취미 요청이 있어야 합니다.")
List<HobbyWriteRequest> hobbies,

@Valid
@NotNull(message = "스타일 요청이 있어야 합니다.")
List<StyleWriteRequest> styles
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.atwoz.member.application.info.hobby;

import com.atwoz.member.application.info.hobby.event.HobbyUpdatedEvent;
import com.atwoz.member.application.info.hobby.event.HobbyWroteEvent;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.util.List;

@RequiredArgsConstructor
@Component
public class HobbyEventHandler {

private final MemberHobbyService memberHobbyService;

@EventListener
public void writeHobbies(final HobbyWroteEvent event) {
Long memberId = event.getMemberId();
List<String> hobbyCodes = event.getHobbyCodes();

memberHobbyService.saveMemberHobbies(memberId, hobbyCodes);
}

@EventListener
public void updateHobbies(final HobbyUpdatedEvent event) {
Long memberId = event.getMemberId();
List<String> hobbyCodes = event.getHobbyCodes();

memberHobbyService.updateMemberHobbies(memberId, hobbyCodes);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.atwoz.member.application.info.hobby;

import com.atwoz.member.domain.info.hobby.Hobby;
import com.atwoz.member.domain.info.hobby.MemberHobby;
import com.atwoz.member.domain.info.hobby.MemberHobbyRepository;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;

@RequiredArgsConstructor
@Transactional(readOnly = true)
@Service
public class MemberHobbyService {

private final MemberHobbyRepository memberHobbyRepository;

@Transactional
public void saveMemberHobbies(final Long memberId, final List<String> hobbyCodes) {
saveMemberHobbiesByHobbyCodes(memberId, hobbyCodes);
}

private void saveMemberHobbiesByHobbyCodes(final Long memberId, final List<String> hobbyCodes) {
List<MemberHobby> memberHobbies = Hobby.findAllByCodes(hobbyCodes)
.stream()
.map(hobby -> new MemberHobby(memberId, hobby))
.toList();

memberHobbyRepository.saveAll(memberHobbies);
}

@Transactional
public void updateMemberHobbies(final Long memberId, final List<String> hobbyCodes) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

변경감지로 업데이트 할 수 있지 않을까요? 쿼리 문제도 그렇고, 도메인 로직을 외부에서 처리하는 것처럼 보이네요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

이것과 관련해서는 고민점이 있습니다.

  • MemberHobby, MemberStyle은 memberId와 Hobby / Style이 M:N으로 되어 있는 구조입니다.
  • 그렇기 때문에 변경 감지를 하기 위해서는, 기존에 저장된 내역과 새로 들어온 요청들을 하나씩 검사하면서 아래 경우의 수가 존재하게 됩니다.
    • 회원의 취미/스타일 갯수 > 새로 들어온 (수정할) 취미/스타일 갯수
      • 이 때는 새로 들어온 갯수만큼 변경 감지를 이용하고, (회원의 취미/스타일 갯수) - (새로 들어온 취미/스타일 갯수)만큼 삭제 쿼리가 발생합니다.
    • 회원의 취미/스타일 갯수 = 새로 들어온 (수정할) 취미/스타일 갯수 (이 때는 말씀하신 변경 감지를 이끌어낼 수 있을 듯 합니다.)
    • 회원의 취미/스타일 갯수 < 새로 들어온 (수정할) 취미/스타일 갯수
      • 이 때는 저장된 갯수만큼 변경 감지를 이용하고, (새로 들어온 취미/스타일 갯수) - (회원의 취미/스타일 갯수)만큼 추가 쿼리가 발생합니다.
  • 이렇듯 변경 감지를 위해서는 세 가지에 대해서 각각 구현을 하고, 그렇기에 복잡도가 올라간다는 생각이 들었습니다.
  • 그 대신, 기존에 updateMemberHobbies를 할 때 작성했던 deleteHobbiesByMemberId 메서드가 저장되었던 취미 갯수만큼 각각 delete 쿼리가 일어났던 문제를 @Query("delete from MemberHobby mh where mh.memberId = :memberId")로 한 번에 삭제하도록 수정했는데, 이런 방식으로 이끌어나가도 될 지 여쭤드립니다..!

memberHobbyRepository.deleteHobbiesByMemberId(memberId);

saveMemberHobbiesByHobbyCodes(memberId, hobbyCodes);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.atwoz.member.application.info.hobby.dto;

import jakarta.validation.constraints.NotBlank;

public record HobbyUpdateRequest(
@NotBlank(message = "취미가 작성되어야 합니다.")
String hobby
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.atwoz.member.application.info.hobby.dto;

import jakarta.validation.constraints.NotBlank;

public record HobbyWriteRequest(
@NotBlank(message = "취미가 작성되어야 합니다.")
String hobby
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.atwoz.member.application.info.hobby.event;

import com.atwoz.global.event.Event;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.List;

@Getter
@RequiredArgsConstructor
public class HobbyUpdatedEvent extends Event {

private final Long memberId;
private final List<String> hobbyCodes;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.atwoz.member.application.info.hobby.event;

import com.atwoz.global.event.Event;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import java.util.List;

@Getter
@RequiredArgsConstructor
public class HobbyWroteEvent extends Event {

private final Long memberId;
private final List<String> hobbyCodes;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.atwoz.member.application.info.option;

import com.atwoz.member.application.info.option.event.OptionUpdatedEvent;
import com.atwoz.member.application.info.option.event.OptionWroteEvent;
import com.atwoz.member.application.info.option.dto.OptionUpdateRequest;
import com.atwoz.member.application.info.option.dto.OptionWriteRequest;
import lombok.RequiredArgsConstructor;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

@RequiredArgsConstructor
@Component
public class OptionEventHandler {

private final OptionService optionService;

@EventListener
public void writeOption(final OptionWroteEvent event) {
Long memberId = event.getMemberId();
OptionWriteRequest request = event.getRequest();

optionService.writeOption(memberId, request);
}

@EventListener
public void updateOption(final OptionUpdatedEvent event) {
Long memberId = event.getMemberId();
OptionUpdateRequest request = event.getRequest();

optionService.updateOption(memberId, request);
}
}
Loading
Loading