From 76e8a57dacf68622445f13da64c5b95c433f26d6 Mon Sep 17 00:00:00 2001 From: mikekks Date: Thu, 7 Nov 2024 15:30:01 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=AA=A8=EC=9E=84=EC=9E=A5=EC=9D=80=20?= =?UTF-8?q?=EA=B3=B5=EB=8F=99=EB=AA=A8=EC=9E=84=EC=9E=A5=EC=9D=B4=20?= =?UTF-8?q?=EB=90=A0=20=EC=88=98=20=EC=97=86=EB=8F=84=EB=A1=9D=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sopt/makers/crew/main/entity/meeting/CoLeader.java | 8 ++++++++ .../makers/crew/main/global/exception/ErrorStatus.java | 1 + 2 files changed, 9 insertions(+) diff --git a/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/CoLeader.java b/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/CoLeader.java index d8836a65..0dee399b 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/CoLeader.java +++ b/main/src/main/java/org/sopt/makers/crew/main/entity/meeting/CoLeader.java @@ -1,7 +1,12 @@ package org.sopt.makers.crew.main.entity.meeting; +import static org.sopt.makers.crew.main.global.exception.ErrorStatus.*; + +import java.util.Objects; + import org.sopt.makers.crew.main.entity.common.BaseTimeEntity; import org.sopt.makers.crew.main.entity.user.User; +import org.sopt.makers.crew.main.global.exception.BadRequestException; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; @@ -38,6 +43,9 @@ public class CoLeader extends BaseTimeEntity { @Builder private CoLeader(Meeting meeting, User user) { + if (Objects.equals(meeting.getUserId(), user.getId())) { + throw new BadRequestException(LEADER_CANNOT_BE_CO_LEADER_APPLY.getErrorCode()); + } this.meeting = meeting; this.user = user; } diff --git a/main/src/main/java/org/sopt/makers/crew/main/global/exception/ErrorStatus.java b/main/src/main/java/org/sopt/makers/crew/main/global/exception/ErrorStatus.java index 645bee08..4026b7f2 100644 --- a/main/src/main/java/org/sopt/makers/crew/main/global/exception/ErrorStatus.java +++ b/main/src/main/java/org/sopt/makers/crew/main/global/exception/ErrorStatus.java @@ -36,6 +36,7 @@ public enum ErrorStatus { MAX_IMAGE_UPLOAD_EXCEEDED("이미지는 최대 10개까지만 업로드 가능합니다."), LEADER_CANNOT_APPLY("모임장은 신청할 수 없습니다."), CO_LEADER_CANNOT_APPLY("공동 모임장은 신청할 수 없습니다."), + LEADER_CANNOT_BE_CO_LEADER_APPLY("모임장은 공동 모임장이 될 수 없습니다."), /** * 401 UNAUTHORIZED