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

issue/189 ♻️ Refactor : 소셜로그인 최종완료 API 수정 #190

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public static Member toSocialMember(MemberRequestDto.MemberInfoDto request, Stri
.name(request.getName())
.phoneNum(request.getPhoneNum())
.termsAgree(new ArrayList<>())
.fcmTokenList(new ArrayList<>())
.build();
return staticMemberRepository.save(member);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/zipdabang/server/domain/member/FcmToken.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class FcmToken {

public void setMember(Member member){
if(this.member != null)
member.getFcmTokenList().remove(this);
this.member.getFcmTokenList().remove(this);
this.member = member;
member.getFcmTokenList().add(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,15 @@ public OAuthJoin.OAuthJoinDto joinInfoComplete(MemberRequestDto.MemberInfoDto re
return savedTermsAgree;
}).collect(Collectors.toList());

FcmToken fcmToken = FcmToken.builder()
.token(request.getFcmToken())
.serialNumber(request.getSerialNumber())
.build();

fcmToken.setMember(joinUser);

fcmTokenRepository.save(fcmToken);

return OAuthJoin.OAuthJoinDto.builder()
.refreshToken(redisService.generateRefreshToken(request.getEmail()).getToken())
.accessToken(redisService.saveLoginStatus(joinUser.getMemberId(), tokenProvider.createAccessToken(joinUser.getMemberId(), type.equals("kakao") ? SocialType.KAKAO.toString() : SocialType.GOOGLE.toString(),request.getEmail(),Arrays.asList(new SimpleGrantedAuthority("USER")))))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public static class MemberInfoDto {
@NotBlank
private String phoneNum;

@NotBlank
private String fcmToken;

@NotBlank
private String serialNumber;

private List<Long> agreeTermsIdList;

private List<Long> preferBeverages;
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ spring:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
# show_sql: true
# format_sql: true
show_sql: true
format_sql: true
use_sql_comments: true
hbm2ddl:
auto: update
Expand Down
Loading