Skip to content

Commit

Permalink
fix(#119): 원서 상태 검증 변경
Browse files Browse the repository at this point in the history
- 제출상태를 제외한 모든 원서에서 검증 조건을 최종제출, 승인, 접수가 아닌 원서를 검증하는 것으로 변경했어요.
  • Loading branch information
jyj1289 committed Sep 8, 2024
1 parent ffc74a4 commit 1c97996
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ByteArrayResource execute(User user) {
}

private void validateFormStatus(Form form) {
if (form.isSubmitted()) {
if (!form.isFinalSubmitted() && !form.isApproved() && !form.isReceived()) {
throw new InvalidFormStatusException();
}
}
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/bamdoliro/maru/domain/form/domain/Form.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,11 @@ public boolean isRejected() {
return status.equals(FormStatus.REJECTED);
}

public boolean isSubmitted() {
return status.equals(FormStatus.SUBMITTED);
}
public boolean isSubmitted() { return status.equals(FormStatus.SUBMITTED); }

public boolean isFinalSubmitted() { return status.equals(FormStatus.FINAL_SUBMITTED); }

public boolean isApproved() { return status.equals(FormStatus.APPROVED); }

public boolean isReceived() {
return isFirstPassed() != null || status.equals(FormStatus.RECEIVED);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class GenerateProofOfApplicationUseCaseTest {
}

@Test
void 접수증을_생성할__상태가_최종제출이_아닌_사용자라면_에러가_발생한다() {
void 접수증을_생성할__상태가_최종제출_또는_승인_또는_접수_아닌_사용자라면_에러가_발생한다() {
// given
User user = UserFixture.createUser();
Form form = FormFixture.createForm(FormType.MULTI_CHILDREN);
Expand Down

0 comments on commit 1c97996

Please sign in to comment.