-
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.
GETP-175 feat: 프로젝트 지원자 목록 조회 기능 구현 (#121)
* GETP-175 feat: 프로젝트 지원자 목록 조회 기능 구현 * GETP-175 rename: description.response에서 description으로 이동 * GETP-175 test: 프로젝트 지원자 목록 조회 단위 테스트 작성 * GETP-175 docs: 프로젝트 지원자 목록 조회 API 문서 작성 * GETP-175 fix: 의뢰한 프로젝트 목록 조회 API 문서 스니펫 경로 오류 수정
- Loading branch information
Showing
27 changed files
with
586 additions
and
148 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
operation::/get-applicants-by-project-id/get-applicants-by-project-id[snippets="http-request,request-headers,path-parameters,query-parameters,http-response,response-fields-data"] |
28 changes: 28 additions & 0 deletions
28
src/docs/asciidoc/project/get-my-commissioned-projects.adoc
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,28 @@ | ||
==== HTTP request | ||
include::{snippets}/get-my-commissioned-projects/get-my-commissioned-projects/http-request.adoc[] | ||
|
||
==== Request headers | ||
include::{snippets}/get-my-commissioned-projects/get-my-commissioned-projects/request-headers.adoc[] | ||
|
||
==== Query parameters | ||
|
||
include::{snippets}/get-my-commissioned-projects/get-my-commissioned-projects/query-parameters.adoc[] | ||
|
||
==== Sort parameters | ||
[cols=2*] | ||
|=== | ||
|최신순 정렬 | ||
|`sort=createdAt,desc` | ||
|
||
|높은 가격 순 정렬 | ||
|`sort=payment,desc` | ||
|
||
|마감 임박 순 정렬 | ||
|`sort=applicationDuration,desc` | ||
|=== | ||
|
||
==== HTTP response | ||
include::{snippets}/get-my-commissioned-projects/get-my-commissioned-projects/http-response.adoc[] | ||
|
||
==== Response fields | ||
include::{snippets}/get-my-commissioned-projects/get-my-commissioned-projects/response-fields-data.adoc[] |
This file was deleted.
Oops, something went wrong.
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
14 changes: 14 additions & 0 deletions
14
src/main/java/es/princip/getp/domain/project/exception/NotMyProjectException.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,14 @@ | ||
package es.princip.getp.domain.project.exception; | ||
|
||
import es.princip.getp.infra.exception.ErrorDescription; | ||
import es.princip.getp.infra.exception.ForbiddenException; | ||
|
||
public class NotMyProjectException extends ForbiddenException { | ||
|
||
private static final String code = "NOT_MY_PROJECT"; | ||
private static final String message = "해당 프로젝트의 의뢰자가 아닙니다."; | ||
|
||
public NotMyProjectException() { | ||
super(ErrorDescription.of(code, message)); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/es/princip/getp/domain/project/query/application/ProjectApplicantService.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,39 @@ | ||
package es.princip.getp.domain.project.query.application; | ||
|
||
import es.princip.getp.domain.client.command.domain.Client; | ||
import es.princip.getp.domain.client.command.domain.ClientRepository; | ||
import es.princip.getp.domain.client.exception.NotFoundClientException; | ||
import es.princip.getp.domain.member.command.domain.model.Member; | ||
import es.princip.getp.domain.people.query.dto.people.DetailPeopleResponse; | ||
import es.princip.getp.domain.project.command.domain.Project; | ||
import es.princip.getp.domain.project.command.domain.ProjectRepository; | ||
import es.princip.getp.domain.project.exception.NotFoundProjectException; | ||
import es.princip.getp.domain.project.exception.NotMyProjectException; | ||
import es.princip.getp.domain.project.query.dao.ProjectApplicantDao; | ||
import es.princip.getp.infra.dto.response.PageResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.data.domain.Pageable; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class ProjectApplicantService { | ||
|
||
private final ProjectApplicantDao projectApplicantDao; | ||
private final ClientRepository clientRepository; | ||
private final ProjectRepository projectRepository; | ||
|
||
public PageResponse<DetailPeopleResponse> getApplicants( | ||
final Long projectId, | ||
final Member member, | ||
final Pageable pageable | ||
) { | ||
final Long memberId = member.getMemberId(); | ||
final Client client = clientRepository.findByMemberId(memberId).orElseThrow(NotFoundClientException::new); | ||
final Project project = projectRepository.findById(projectId).orElseThrow(NotFoundProjectException::new); | ||
if (!project.isClient(client)) { | ||
throw new NotMyProjectException(); | ||
} | ||
return PageResponse.from(projectApplicantDao.findPagedApplicantByProjectId(projectId, pageable)); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/main/java/es/princip/getp/domain/project/query/dao/ProjectApplicantDao.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,10 @@ | ||
package es.princip.getp.domain.project.query.dao; | ||
|
||
import es.princip.getp.domain.people.query.dto.people.DetailPeopleResponse; | ||
import org.springframework.data.domain.Page; | ||
import org.springframework.data.domain.Pageable; | ||
|
||
public interface ProjectApplicantDao { | ||
|
||
Page<DetailPeopleResponse> findPagedApplicantByProjectId(Long projectId, Pageable pageable); | ||
} |
Oops, something went wrong.