Skip to content

Commit

Permalink
Fix(#68): 온보딩시 fcm토큰 설정 추가 (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
nohy6630 authored Nov 15, 2023
1 parent 8f45616 commit 9d418ad
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
@Tag(name = "members", description = "사용자 관련 API")
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/members")
public class MemberController {
private final MemberService memberService;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class OnboardingRequest {
@Schema(defaultValue = "초롱이")
@NotNull
@NotNull(message = "nickname은 null일 수 없습니다.")
private String nickname;

@NotNull(message = "fcm token은 null일 수 없습니다.")
private String fcmToken;

private List<OnboardingAddress> addresses;

private List<OnboardingDisasterType> disasterTypes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ public class Member extends BaseTimeEntity {
private List<NotificationRegion> notificationRegions = new ArrayList<>();

@Builder
public Member(String email, String nickName, String realName, Integer heartCnt) {
public Member(String email, String nickName, String realName, Integer heartCnt, String fcmToken) {
this.email = email;
this.nickName = nickName;
this.realName = realName;
this.heartCnt = heartCnt;
this.fcmToken = fcmToken;
}

public static Member of(String email, String realName) {
Expand All @@ -83,8 +84,9 @@ public void updateProfileImageUrl(String imageUrl) {
this.profileImageUrl = imageUrl;
}

public void updateNickName(String nickName) {
public void setOnboardingData(String nickName, String fcmToken) {
this.nickName = nickName;
this.fcmToken = fcmToken;
}

public void plusHeart(int heart) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public void create(String email, String realName) {
public void initMemberData(String email, OnboardingRequest onboardingRequest) {
Member member = memberRepository.findByEmail(email)
.orElseThrow(NotFoundMemberException::new);
member.updateNickName(onboardingRequest.getNickname());
member.setOnboardingData(onboardingRequest.getNickname(), onboardingRequest.getFcmToken());
notificationDisasterRepository.deleteAllByMemberId(member.getId());
notificationRegionRepository.deleteAllByMemberId(member.getId());
for (OnboardingAddress address : onboardingRequest.getAddresses()) {
Expand Down

0 comments on commit 9d418ad

Please sign in to comment.