Skip to content

Commit

Permalink
refactor: LIMIT 상태일때만 모집인원을 검사하도록 수정 (#66)
Browse files Browse the repository at this point in the history
* feat: 리턴 타입 capacityType 추가 (#14)

* refactor: LIMIT 상태일때만 모집인원을 검사하도록 수정 (#14)
  • Loading branch information
ympark99 authored Oct 8, 2023
1 parent d51b0f5 commit bd28211
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.onna.onnaback.domain.member.application.port.in.MemberUseCase;
import com.onna.onnaback.domain.member.domain.Member;
import com.onna.onnaback.domain.spark.application.port.in.SparkUseCase;
import com.onna.onnaback.domain.spark.domain.CapacityType;
import com.onna.onnaback.domain.spark.domain.Spark;
import com.onna.onnaback.global.exception.BaseException;
import com.onna.onnaback.global.exception.ErrorCode;
Expand All @@ -38,7 +39,7 @@ public String apply(Member applicant, Long sparkId) throws BaseException {
if (loadApplyPort.isAlreadyApply(applicant.getMemberId(), sparkId)) {
throw new BaseException(ErrorCode.APPLY_ALREADY);
}
if (spark.getMemberCount() >= spark.getCapacity()) {
if (spark.getCapacityType() == CapacityType.LIMIT && spark.getMemberCount() >= spark.getCapacity()) {
throw new BaseException(ErrorCode.OVER_MEMBERCOUNT);
}

Expand Down

0 comments on commit bd28211

Please sign in to comment.