-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π :: (#471) μ¬μ§μ api
- Loading branch information
Showing
6 changed files
with
112 additions
and
11 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
...n/java/team/retum/jobis/domain/application/dto/response/QueryRejectionReasonResponse.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,11 @@ | ||
package team.retum.jobis.domain.application.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
public class QueryRejectionReasonResponse { | ||
|
||
private final String rejectionReason; | ||
} |
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
27 changes: 27 additions & 0 deletions
27
...rc/main/java/team/retum/jobis/domain/application/usecase/QueryRejectionReasonUseCase.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,27 @@ | ||
package team.retum.jobis.domain.application.usecase; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import team.retum.jobis.common.annotation.ReadOnlyUseCase; | ||
import team.retum.jobis.domain.application.dto.response.QueryRejectionReasonResponse; | ||
import team.retum.jobis.domain.application.exception.ApplicationNotFoundException; | ||
import team.retum.jobis.domain.application.model.Application; | ||
import team.retum.jobis.domain.application.model.ApplicationStatus; | ||
import team.retum.jobis.domain.application.spi.QueryApplicationPort; | ||
|
||
@RequiredArgsConstructor | ||
@ReadOnlyUseCase | ||
public class QueryRejectionReasonUseCase { | ||
|
||
private final QueryApplicationPort queryApplicationPort; | ||
|
||
public QueryRejectionReasonResponse execute(Long applicationId) { | ||
Application application = queryApplicationPort.queryApplicationById(applicationId) | ||
.orElseThrow(() -> ApplicationNotFoundException.EXCEPTION); | ||
|
||
if (application.getApplicationStatus() != ApplicationStatus.REJECTED) { | ||
throw ApplicationNotFoundException.EXCEPTION; | ||
} | ||
|
||
return new QueryRejectionReasonResponse(application.getRejectionReason()); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...application/src/main/java/team/retum/jobis/domain/application/usecase/ReapplyUseCase.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,34 @@ | ||
package team.retum.jobis.domain.application.usecase; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import team.retum.jobis.common.annotation.UseCase; | ||
import team.retum.jobis.domain.application.dto.request.CreateApplicationRequest; | ||
import team.retum.jobis.domain.application.exception.ApplicationNotFoundException; | ||
import team.retum.jobis.domain.application.model.Application; | ||
import team.retum.jobis.domain.application.model.ApplicationAttachment; | ||
import team.retum.jobis.domain.application.model.ApplicationStatus; | ||
import team.retum.jobis.domain.application.spi.CommandApplicationPort; | ||
import team.retum.jobis.domain.application.spi.QueryApplicationPort; | ||
|
||
@RequiredArgsConstructor | ||
@UseCase | ||
public class ReapplyUseCase { | ||
|
||
private final QueryApplicationPort queryApplicationPort; | ||
private final CommandApplicationPort commandApplicationPort; | ||
|
||
public void execute(Long applicationId, CreateApplicationRequest request) { | ||
Application application = queryApplicationPort.queryApplicationById(applicationId) | ||
.orElseThrow(() -> ApplicationNotFoundException.EXCEPTION); | ||
|
||
application.checkApplicationStatus(application.getApplicationStatus(), ApplicationStatus.REJECTED, ApplicationStatus.REQUESTED); | ||
|
||
commandApplicationPort.saveApplication( | ||
application.reapply( | ||
request.getAttachments().stream() | ||
.map(attachment -> new ApplicationAttachment(attachment.getUrl(), attachment.getType())) | ||
.toList() | ||
) | ||
); | ||
} | ||
} |
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