-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor/68 get user info with keyword #69
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6cdcca6
feat: keyword맵에서 value로 key 찾아오기
ChooSeoyeon ad99b76
chore: 주석 수정
ChooSeoyeon 1755595
feat: memberId로 keywordId, keywordName 찾는 method 구현
ChooSeoyeon 601456d
chore: transactional 옵션 추가
ChooSeoyeon 8beda72
Merge branch 'develop' into Refactor/68-get-user-info-with-keyword
ChooSeoyeon ae81272
chore: 필요없는 import문 제거
ChooSeoyeon 6959c93
feat: 작가/회원에 따라 필요한 속성만 반환
ChooSeoyeon ff018d2
refactor: keywordName 얻는 method 분리
ChooSeoyeon 54b388d
chore: ddl-auto update로 수정
ChooSeoyeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
2 changes: 0 additions & 2 deletions
2
src/main/java/com/sptp/backend/common/exception/ExControllerAdvice.java
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
package com.sptp.backend.member.service; | ||
|
||
import com.sptp.backend.art_work.repository.ArtWorkRepository; | ||
import com.sptp.backend.aws.service.AwsService; | ||
import com.sptp.backend.aws.service.FileService; | ||
import com.sptp.backend.member.web.dto.request.*; | ||
|
@@ -11,6 +10,7 @@ | |
import com.sptp.backend.jwt.web.JwtTokenProvider; | ||
import com.sptp.backend.jwt.web.dto.TokenDto; | ||
import com.sptp.backend.jwt.service.JwtService; | ||
import com.sptp.backend.member.web.dto.response.ArtistResponse; | ||
import com.sptp.backend.member.web.dto.response.MemberLoginResponseDto; | ||
import com.sptp.backend.member.web.dto.response.MemberResponse; | ||
import com.sptp.backend.common.KeywordMap; | ||
|
@@ -21,8 +21,6 @@ | |
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.dao.DataIntegrityViolationException; | ||
import org.springframework.dao.DuplicateKeyException; | ||
import org.springframework.data.redis.core.RedisTemplate; | ||
import org.springframework.security.crypto.password.PasswordEncoder; | ||
import org.springframework.stereotype.Service; | ||
|
@@ -277,28 +275,66 @@ public MemberResponse getMember(Long loginMemberId) { | |
Member findMember = memberRepository.findById(loginMemberId) | ||
.orElseThrow(() -> new CustomException(ErrorCode.NOT_FOUND_MEMBER)); | ||
|
||
// 이미지 처리 | ||
String imageUrl = awsStorageUrl + findMember.getImage(); | ||
|
||
if(findMember.isBlankImage()) { | ||
imageUrl = null; | ||
} | ||
|
||
//키워드 처리 | ||
List<String> keywordNameList = getKeywordName(findMember.getId()); | ||
|
||
if(Objects.equals(findMember.getRoles().get(0), "ROLE_ARTIST")) { | ||
MemberResponse artistResponse = ArtistResponse.builder() | ||
.nickname(findMember.getNickname()) | ||
.userId(findMember.getUserId()) | ||
.email(findMember.getEmail()) | ||
.telephone(findMember.getTelephone()) | ||
.image(imageUrl) | ||
.keywords(keywordNameList) | ||
.education(findMember.getEducation()) | ||
.history(findMember.getHistory()) | ||
.description(findMember.getDescription()) | ||
.instagram(findMember.getInstagram()) | ||
.behance(findMember.getBehance()) | ||
.build(); | ||
|
||
return artistResponse; | ||
} | ||
|
||
MemberResponse memberResponse = MemberResponse.builder() | ||
.nickname(findMember.getNickname()) | ||
.userId(findMember.getUserId()) | ||
.email(findMember.getEmail()) | ||
.telephone(findMember.getTelephone()) | ||
.image(imageUrl) | ||
.education(findMember.getEducation()) | ||
.history(findMember.getHistory()) | ||
.description(findMember.getDescription()) | ||
.instagram(findMember.getInstagram()) | ||
.behance(findMember.getBehance()) | ||
.keywords(keywordNameList) | ||
.build(); | ||
|
||
return memberResponse; | ||
} | ||
|
||
@Transactional(readOnly = true) | ||
public List<String> getKeywordName(Long memberId) { | ||
|
||
List<MemberKeyword> findMemberKeywordList = memberKeywordRepository.findByMemberId(memberId); | ||
|
||
// keywordId(value) 리스트 구하기 | ||
List<Integer> keywordIdList = new ArrayList(); | ||
for(MemberKeyword memberKeyword : findMemberKeywordList){ | ||
keywordIdList.add(memberKeyword.getKeywordId()); | ||
} | ||
|
||
// keywordName(key) 리스트 구하기 | ||
List<String> keywordNameList = new ArrayList(); | ||
for(Integer keywordId : keywordIdList) { | ||
keywordNameList.add(KeywordMap.getKeywordName(keywordId)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 깔끔해져서 보기 편하네용 |
||
} | ||
|
||
return keywordNameList; | ||
} | ||
|
||
@Transactional | ||
public void pickArtist(Long loginMemberId, Long artistId) { | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
src/main/java/com/sptp/backend/member/web/dto/response/ArtistResponse.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.sptp.backend.member.web.dto.response; | ||
|
||
import lombok.*; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@SuperBuilder | ||
public class ArtistResponse extends MemberResponse { | ||
|
||
private String education; | ||
private String history; | ||
private String description; | ||
private String instagram; | ||
private String behance; | ||
} |
12 changes: 5 additions & 7 deletions
12
src/main/java/com/sptp/backend/member/web/dto/response/MemberResponse.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
package com.sptp.backend.member.web.dto.response; | ||
|
||
import lombok.*; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.util.List; | ||
|
||
@Getter | ||
@Setter | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Builder | ||
@SuperBuilder | ||
public class MemberResponse { | ||
|
||
private String nickname; | ||
private String userId; | ||
private String email; | ||
private String telephone; | ||
private String image; | ||
|
||
private String education; | ||
private String history; | ||
private String description; | ||
private String instagram; | ||
private String behance; | ||
private List<String> keywords; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ spring: | |
|
||
jpa: | ||
hibernate: | ||
ddl-auto: update | ||
ddl-auto: create | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
|
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KeywordMap에 로직을 포함할 수 있다면 좋을 것 같아요!