Skip to content

Commit

Permalink
[merge] 호스트 정보 수정 API 수정
Browse files Browse the repository at this point in the history
[fix] 호스트 정보 수정 API 수정
  • Loading branch information
bo-ram-bo-ram authored Sep 16, 2024
2 parents 8a7d6df + 4429566 commit f85ee11
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public record HostUpdateRequest(
@NotBlank(message = "소개글이 비어있습니다.")
String description,

@Size(max = 50)
@NotBlank(message = "소셜 링크가 비어있습니다.")
String socialLink
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ public class HostCommandService {

public void updateHostProfile(Long hostId, HostUpdateRequest hostUpdateRequest) {
Host host = hostRepository.findHostByIdOrThrow(hostId);
if (hostRepository.existsByNickname(hostUpdateRequest.nickname()) || guestRepository.existsByNickname(
hostUpdateRequest.nickname()) || submitterRepository.existsByNickname(hostUpdateRequest.nickname())) {
if (!host.getNickname().equals(hostUpdateRequest.nickname()) && (hostRepository.existsByNickname(
hostUpdateRequest.nickname()) || guestRepository.existsByNickname(
hostUpdateRequest.nickname()) || submitterRepository.existsByNickname(hostUpdateRequest.nickname()))) {
throw new CustomException(ErrorCode.DUPLICATION_NICKNAME);
}

host.updateHostProfile(hostUpdateRequest.profileUrl(), hostUpdateRequest.nickname(),
hostUpdateRequest.keyword(),
hostUpdateRequest.description(), hostUpdateRequest.socialLink());
Expand Down

0 comments on commit f85ee11

Please sign in to comment.