Skip to content

Commit

Permalink
Merge pull request #58 from Journey-Together/feature/#14
Browse files Browse the repository at this point in the history
fix : name->nickname 변경
  • Loading branch information
sycuuui authored Jun 9, 2024
2 parents cf89267 + 321ed18 commit 12af617
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public record OpenPlanRes(
String title,
String imageUrl,
Long memberId,
String memberName,
String memberNickname,
String memberImageUrl,
String date
) {
Expand All @@ -24,7 +24,7 @@ public static OpenPlanRes of(Plan plan,String memberImageUrl,String imageUrl){
.title(plan.getTitle())
.imageUrl(imageUrl)
.memberId(plan.getMember().getMemberId())
.memberName(plan.getMember().getName())
.memberNickname(plan.getMember().getNickname())
.memberImageUrl(memberImageUrl)
.date(date)
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package Journey.Together.domain.dairy.dto;

import Journey.Together.domain.dairy.entity.Plan;
import Journey.Together.domain.member.entity.Member;
import lombok.Builder;

import java.util.List;
Expand All @@ -8,14 +10,18 @@
public record PlanDetailRes(
List<String> imageUrls,
List<DailyList> dailyList,
Boolean isWriter
Boolean isWriter,
Long writerId,
String writerNickname
) {
public static PlanDetailRes of(List<String> imageUrls,
List<DailyList> dailyList,Boolean isWriter){
List<DailyList> dailyList, Boolean isWriter, Plan plan){
return PlanDetailRes.builder()
.imageUrls(imageUrls)
.dailyList(dailyList)
.isWriter(isWriter)
.writerId(plan.getMember().getMemberId())
.writerNickname(plan.getMember().getNickname())
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public PlanDetailRes findPlanDetail(Member member, Long planId){
}
//PlanDetailRes - List<String> imageUrls, List<DailyList> dailyList, Boolean isWriter
//Response
return PlanDetailRes.of(imageUrls,dailyLists,isWriter);
return PlanDetailRes.of(imageUrls,dailyLists,isWriter,plan);
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
package Journey.Together.domain.member.controller;

import Journey.Together.domain.member.dto.LoginReq;
import Journey.Together.domain.member.dto.LoginRes;
import Journey.Together.domain.member.enumerate.LoginType;
import Journey.Together.domain.member.service.AuthService;
import Journey.Together.global.common.ApiResponse;
import Journey.Together.global.exception.ApplicationException;
import Journey.Together.global.exception.ErrorCode;
import Journey.Together.global.exception.Success;
import Journey.Together.global.security.PrincipalDetails;
import Journey.Together.global.security.jwt.dto.TokenDto;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public record LoginRes(
@NotNull Long memberId,
@NotNull String email,
@NotNull String name,
@NotNull String nickname,
String profileUuid,
MemberType memberType,
LoginType loginType,
Expand All @@ -25,6 +26,7 @@ public static LoginRes of(Member member, TokenDto tokenDto) {
.memberId(member.getMemberId())
.email(member.getEmail())
.name(member.getName())
.nickname(member.getNickname())
.profileUuid(member.getProfileUuid())
.memberType(member.getMemberType())
.loginType(member.getLoginType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@JsonInclude(JsonInclude.Include.NON_NULL)
public record MemberReq(
@Null
String name,
String nickname,
@Null
String phone,
@Null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@Builder
public record MemberRes(
String name,
String nickname,
String phone,
String profileImage,
String bloodType,
Expand All @@ -22,6 +23,7 @@ public record MemberRes(
public static MemberRes of(Member member,String profileUrl){
return MemberRes.builder()
.name(member.getName())
.nickname(member.getNickname())
.phone(member.getPhone())
.profileImage(profileUrl)
.bloodType(member.getBloodType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ public class Member extends BaseTimeEntity {
@Column(name = "name", nullable = false, columnDefinition = "varchar(50)")
private String name;

@Column(name = "nickname", nullable = false, columnDefinition = "varchar(50)")
private String nickname;

@Column(name = "phone", columnDefinition = "varchar(15)")
private String phone;

Expand Down Expand Up @@ -74,9 +77,10 @@ public class Member extends BaseTimeEntity {
private String refreshToken;

@Builder
public Member(String email, String name, String phone, String profileUuid, LoginType loginType,String bloodType,MemberType memberType, String birth, String allergy, String medication,String part1Rel,String part1Phone,String part2Rel,String part2Phone, String refreshToken) {
public Member(String email, String name,String nickname, String phone, String profileUuid, LoginType loginType,String bloodType,MemberType memberType, String birth, String allergy, String medication,String part1Rel,String part1Phone,String part2Rel,String part2Phone, String refreshToken) {
this.email = email;
this.name = name;
this.nickname=nickname;
this.phone = phone;
this.profileUuid = profileUuid;
this.loginType = loginType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package Journey.Together.domain.member.service;

import Journey.Together.domain.member.dto.LoginReq;
import Journey.Together.domain.member.dto.LoginRes;
import Journey.Together.domain.member.entity.Interest;
import Journey.Together.domain.member.entity.Member;
Expand Down Expand Up @@ -65,7 +64,8 @@ public LoginRes signIn(String token, String type) throws IOException {
s3Client.upload(imageFile,uuid,"profile");
Member newMember = Member.builder()
.email(kakaoProfile.kakao_account().email())
.name(kakaoProfile.kakao_account().profile().nickname())
.name(kakaoProfile.kakao_account().name())
.nickname(kakaoProfile.kakao_account().profile().nickname())
.profileUuid(uuid)
.phone(null)
.memberType(MemberType.valueOf("GENERAL"))
Expand Down Expand Up @@ -101,6 +101,7 @@ public LoginRes signIn(String token, String type) throws IOException {
.email(naverProfile.getEmail() != null ? naverProfile.getEmail() : "Unknown")
.profileUuid(uuid)
.name(naverProfile.getName() != null ? naverProfile.getName() : "Unknown")
.nickname(naverProfile.getNickname() != null ? naverProfile.getNickname() : "Unknown")
.memberType(MemberType.GENERAL)
.loginType(LoginType.NAVER)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ public class MemberService {

public MyPageRes getMypage(Member member){
Long date = Duration.between(member.getCreatedAt(), LocalDateTime.now()).toDays();
return new MyPageRes(member.getName(), 0, date, member.getProfileUuid()+"/profile");
return new MyPageRes(member.getNickname(), 0, date, s3Client.getUrl()+member.getProfileUuid()+"/profile");
}

@Transactional
public void saveInfo(Member member,MemberReq memberReq){
// Validation
memberRepository.findMemberByEmailAndDeletedAtIsNull(member.getEmail()).orElseThrow(()->new ApplicationException(ErrorCode.NOT_FOUND_EXCEPTION));
//Business
if (memberReq.name() != null) {
member.setName(memberReq.name());
if (memberReq.nickname() != null) {
member.setNickname(memberReq.nickname());
}
if (memberReq.phone() != null) {
member.setPhone(memberReq.phone());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public record PlaceReivewListDto(
LocalDate date
) {
public static PlaceReivewListDto of(PlaceReview placeReview, List<String> imageList){
return new PlaceReivewListDto(placeReview.getId(),placeReview.getMember().getName(), placeReview.getMember().getProfileUuid(),
return new PlaceReivewListDto(placeReview.getId(),placeReview.getMember().getNickname(), placeReview.getMember().getProfileUuid(),
placeReview.getContent(), imageList, placeReview.getGrade(), placeReview.getDate());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public class KakaoClient {
@Value("${spring.security.oauth2.client.provider.kakao.user-info-uri}")
private String kakaoUserInfoUri;

@Value("${spring.security.oauth2.kakao.admin-key}")
private String adminKey;

public KakaoProfile getMemberInfo(String accesToken) {
// 요청 기본 객체 생성
WebClient webClient = WebClient.create(kakaoUserInfoUri);
Expand All @@ -56,4 +59,16 @@ public KakaoProfile getMemberInfo(String accesToken) {

return kakaoProfile;
}

public void unlink(){
WebClient webClient = WebClient.create("https://kapi.kakao.com/v1/user/unlink");
// 요청 보내서 응답 받기
String response = webClient.post()
.uri("https://kapi.kakao.com/v1/user/unlink")
.header("Content-Type", "application/x-www-form-urlencoded;charset=utf-8")
.header("Authorization", adminKey)
.retrieve()
.bodyToMono(String.class)
.block();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,23 @@ public record KakaoProfile(
public record Properties(
String nickname,
String profile_image,
String thumbnail_image
String thumbnail_image,
String name
) {
}

// 사용자의 카카오 계정 정보
public record KakaoAccount(
Boolean profile_nickname_needs_agreement,
Boolean profile_image_needs_agreement,
Boolean name_needs_agreement,
Profile profile,
Boolean has_email,
Boolean email_needs_agreement,
Boolean is_email_valid,
Boolean is_email_verified,
String email
String email,
String name
) {
public record Profile(
String nickname,
Expand Down

0 comments on commit 12af617

Please sign in to comment.