Skip to content

Commit

Permalink
fix: 모임장은 공동모임장이 될 수 없도록 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
mikekks committed Nov 7, 2024
1 parent 00a6ba8 commit 76e8a57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 76e8a57

Please sign in to comment.