-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨[STMT-179] 활동 생성 request body 필드 필수 요청 값 수정 및 검증 로직 추가 (#140)
* 🗃️ [STMT-179] activity 테이블에 활동 기간 nullable, link 컬럼 추가 * ✨ [STMT-179] request body의 필드 유효성 검증 방침 변경: null 허용 * ✨ [STMT-179] 활동을 상속받은 각 활동 유형마다 필수 입력값 검증 로직 추가 * ✨ [STMT-179] 활동 생성시 멤버 관리자 여부 대신 스터디 멤버인지 검증 * ✅ [STMT-179] 활동 생성 기존 테스트 수정 및 추가 예외 사항 테스트 케이스 작성 * 📝 [STMT-179] 활동 생성 API 명세서 추가 작성
- Loading branch information
Showing
18 changed files
with
351 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/com/stumeet/server/activity/domain/model/ActivityPeriod.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.stumeet.server.activity.domain.model; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
import com.stumeet.server.common.exception.model.BadRequestException; | ||
import com.stumeet.server.common.response.ErrorCode; | ||
|
||
import lombok.Builder; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
public class ActivityPeriod { | ||
|
||
private LocalDateTime startDate; | ||
|
||
private LocalDateTime endDate; | ||
|
||
@Builder | ||
private ActivityPeriod(LocalDateTime startDate, LocalDateTime endDate) { | ||
validate(startDate, endDate); | ||
|
||
this.startDate = startDate; | ||
this.endDate = endDate; | ||
} | ||
|
||
private void validate(LocalDateTime startDate, LocalDateTime endDate) { | ||
validateNonNull(startDate, endDate); | ||
validatePeriod(startDate, endDate); | ||
} | ||
|
||
private void validateNonNull(LocalDateTime startDate, LocalDateTime endDate) { | ||
if (startDate == null || endDate == null) { | ||
throw new BadRequestException(ErrorCode.ACTIVITY_PERIOD_REQUIRED_EXCEPTION); | ||
} | ||
} | ||
|
||
private void validatePeriod(LocalDateTime startDate, LocalDateTime endDate) { | ||
if (startDate.isAfter(endDate)) { | ||
throw new BadRequestException(ErrorCode.INVALID_PERIOD_EXCEPTION); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.