Skip to content

Commit

Permalink
Merge pull request #141 from Modagbul/feat/alarm_minsu
Browse files Browse the repository at this point in the history
fix: 마이페이지에서 수정할 때 닉네임 중복검사
  • Loading branch information
minsu20 authored Dec 13, 2023
2 parents 6cd1d44 + 20ce5e3 commit c7ffca4
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.moing.backend.domain.mypage.application.service;

import com.moing.backend.domain.auth.exception.NicknameDuplicationException;
import com.moing.backend.domain.member.domain.entity.Member;
import com.moing.backend.domain.member.domain.service.MemberCheckService;
import com.moing.backend.domain.member.domain.service.MemberGetService;
import com.moing.backend.domain.mypage.application.dto.request.UpdateProfileRequest;
import com.moing.backend.domain.mypage.application.dto.response.GetProfileResponse;
Expand All @@ -15,6 +17,7 @@ public class ProfileUseCase {

private final MemberGetService memberGetService;
private final UpdateUtils updateUtils;
private final MemberCheckService memberCheckService;

@Transactional(readOnly = true)
public GetProfileResponse getProfile(String socialId){
Expand All @@ -33,6 +36,10 @@ public void updateProfile(String socialId, UpdateProfileRequest updateProfileReq
UpdateUtils.getUpdatedValue(updateProfileRequest.getIntroduction(), member.getIntroduction())
);

if(updateProfileRequest.getNickName()!=null){
if(memberCheckService.checkNickname(updateProfileRequest.getNickName())) throw new NicknameDuplicationException(); //닉네임 중복검사 (이중체크)
}

updateUtils.deleteOldImgUrl(updateProfileRequest.getProfileImage(), oldProfileImageUrl);
}

Expand Down

0 comments on commit c7ffca4

Please sign in to comment.