-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* refactor: 공고 상태 수정 API 분리 * fix: enum 관련 에러 처리 수정
- Loading branch information
1 parent
6c53cbe
commit 5b450bb
Showing
13 changed files
with
77 additions
and
37 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
9 changes: 9 additions & 0 deletions
9
...om/sponus/sponusbe/domain/announcement/dto/response/AnnouncementStatusUpdateResponse.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,9 @@ | ||
package com.sponus.sponusbe.domain.announcement.dto.response; | ||
|
||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record AnnouncementStatusUpdateResponse( | ||
@NotBlank(message = "[ERROR] 공고 상태 입력은 필수 입니다.") | ||
String status | ||
) { | ||
} |
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
13 changes: 12 additions & 1 deletion
13
src/main/java/com/sponus/sponusbe/domain/announcement/entity/enums/AnnouncementStatus.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 |
---|---|---|
@@ -1,5 +1,16 @@ | ||
package com.sponus.sponusbe.domain.announcement.entity.enums; | ||
|
||
import com.sponus.sponusbe.domain.announcement.exception.AnnouncementErrorCode; | ||
import com.sponus.sponusbe.domain.announcement.exception.AnnouncementException; | ||
|
||
public enum AnnouncementStatus { | ||
OPENED, CLOSED | ||
OPENED, CLOSED; | ||
|
||
public static AnnouncementStatus of(String input) { | ||
try { | ||
return AnnouncementStatus.valueOf(input.toUpperCase()); | ||
} catch (Exception e) { | ||
throw new AnnouncementException(AnnouncementErrorCode.INVALID_ANNOUNCEMENT_STATUS); | ||
} | ||
} | ||
} |
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
8 changes: 3 additions & 5 deletions
8
src/main/java/com/sponus/sponusbe/domain/propose/dto/request/ProposeStatusUpdateRequest.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 |
---|---|---|
@@ -1,11 +1,9 @@ | ||
package com.sponus.sponusbe.domain.propose.dto.request; | ||
|
||
import com.sponus.sponusbe.domain.propose.entity.ProposeStatus; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.NotBlank; | ||
|
||
public record ProposeStatusUpdateRequest( | ||
@NotNull(message = "[ERROR] 제안 상태 입력은 필수 입니다.") | ||
ProposeStatus status | ||
@NotBlank(message = "[ERROR] 제안 상태 입력은 필수 입니다.") | ||
String status | ||
) { | ||
} |
13 changes: 11 additions & 2 deletions
13
src/main/java/com/sponus/sponusbe/domain/propose/entity/ProposeStatus.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 |
---|---|---|
@@ -1,9 +1,18 @@ | ||
package com.sponus.sponusbe.domain.propose.entity; | ||
|
||
import com.sponus.sponusbe.domain.propose.exception.ProposeErrorCode; | ||
import com.sponus.sponusbe.domain.propose.exception.ProposeException; | ||
|
||
public enum ProposeStatus { | ||
// 제안을 보낸 측: PENDING | ||
// 제안을 받은 측: VIEWED, ACCEPTED, REJECTED, SUSPENDED, ACCEPTED_AND_PAID | ||
PENDING, VIEWED, ACCEPTED, REJECTED, SUSPENDED, ACCEPTED_AND_PAID, | ||
// 열람됨 | ||
PENDING, VIEWED, ACCEPTED, REJECTED, SUSPENDED, ACCEPTED_AND_PAID; | ||
|
||
public static ProposeStatus of(String input) { | ||
try { | ||
return ProposeStatus.valueOf(input.toUpperCase()); | ||
} catch (Exception e) { | ||
throw new ProposeException(ProposeErrorCode.INVALID_PROPOSE_STATUS); | ||
} | ||
} | ||
} |
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