Skip to content

Commit

Permalink
⚙️ :: (#develop) 지원서 리스트로 쭉
Browse files Browse the repository at this point in the history
  • Loading branch information
geunoo committed Dec 6, 2023
1 parent e5e5be6 commit 147604c
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

public interface QueryApplicationPort {

List<ApplicationVO> queryApplicationByConditions(Long recruitmentId, Long studentId, ApplicationStatus applicationStatus, String studentName, Long page);
List<ApplicationVO> queryApplicationByConditions(Long recruitmentId, Long studentId, ApplicationStatus applicationStatus, String studentName);

Long queryApplicationCountByCondition(ApplicationStatus applicationStatus, String studentName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public class CompanyQueryApplicationsUseCase {
private final QueryRecruitmentPort queryRecruitmentPort;
private final SecurityPort securityPort;

public CompanyQueryApplicationsResponse execute(Long page) {
public CompanyQueryApplicationsResponse execute() {
Company company = securityPort.getCurrentCompany();

Recruitment recruitment = queryRecruitmentPort.queryRecentRecruitmentByCompanyId(company.getId())
.orElseThrow(() -> RecruitmentNotFoundException.EXCEPTION);

return new CompanyQueryApplicationsResponse(
queryApplicationPort.queryApplicationByConditions(
recruitment.getId(), null, ApplicationStatus.SEND, null, page
recruitment.getId(), null, ApplicationStatus.SEND, null
).stream()
.map(application -> CompanyQueryApplicationResponse.builder()
.applicationId(application.getId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ public class QueryMyApplicationsUseCase {
private final QueryApplicationPort queryApplicationPort;
private final SecurityPort securityPort;

public QueryMyApplicationsResponse execute(Long page) {
public QueryMyApplicationsResponse execute() {
Student student = securityPort.getCurrentStudent();

return new QueryMyApplicationsResponse(
queryApplicationPort.queryApplicationByConditions(
null, student.getId(), null, null, page).stream()
null, student.getId(), null, null
).stream()
.map(application -> QueryMyApplicationResponse.builder()
.applicationId(application.getId())
.recruitmentId(application.getRecruitmentId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ public class TeacherQueryApplicationsUseCase {

private final QueryApplicationPort applicationPersistenceAdapter;

public TeacherQueryApplicationsResponse execute(ApplicationStatus applicationStatus, String studentName, Long recruitmentId, Long page) {
public TeacherQueryApplicationsResponse execute(ApplicationStatus applicationStatus, String studentName, Long recruitmentId) {
return new TeacherQueryApplicationsResponse(
applicationPersistenceAdapter.queryApplicationByConditions(
recruitmentId, null, applicationStatus, studentName, page
recruitmentId, null, applicationStatus, studentName
).stream()
.map(application -> TeacherQueryApplicationResponse.builder()
.applicationId(application.getId())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ public List<ApplicationVO> queryApplicationByConditions(
Long recruitmentId,
Long studentId,
ApplicationStatus applicationStatus,
String studentName,
Long page
String studentName
) {
return queryFactory
.selectFrom(applicationEntity)
Expand All @@ -62,8 +61,6 @@ public List<ApplicationVO> queryApplicationByConditions(
eqApplicationStatus(applicationStatus),
containStudentName(studentName)
)
.offset(page * 11)
.limit(11)
.orderBy(applicationEntity.createdAt.desc())
.transform(
groupBy(applicationEntity.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ public void deleteApplication(@PathVariable("application-id") Long applicationId
public TeacherQueryApplicationsResponse queryTeacherApplicationList(
@RequestParam(value = "application_status", required = false) ApplicationStatus applicationStatus,
@RequestParam(value = "student_name", required = false) String studentName,
@RequestParam(value = "recruitment_id", required = false) Long recruitmentId,
@RequestParam(value = "page", required = false, defaultValue = "1") @Positive Long page
@RequestParam(value = "recruitment_id", required = false) Long recruitmentId
) {
return queryApplicationListService.execute(applicationStatus, studentName, recruitmentId, page - 1);
return queryApplicationListService.execute(applicationStatus, studentName, recruitmentId);
}

@GetMapping("/count")
Expand All @@ -92,17 +91,13 @@ public TotalPageCountResponse queryApplicationCount(
}

@GetMapping("/company")
public CompanyQueryApplicationsResponse queryCompanyApplicationList(
@RequestParam(value = "page", required = false, defaultValue = "1") @Positive Long page
) {
return companyQueryApplicationsUseCase.execute(page - 1);
public CompanyQueryApplicationsResponse queryCompanyApplicationList() {
return companyQueryApplicationsUseCase.execute();
}

@GetMapping("/students")
public QueryMyApplicationsResponse queryMyApplications(
@RequestParam(value = "page", required = false, defaultValue = "1") @Positive Long page
) {
return queryMyApplicationsUseCase.execute(page - 1);
public QueryMyApplicationsResponse queryMyApplications() {
return queryMyApplicationsUseCase.execute();
}

@ResponseStatus(HttpStatus.NO_CONTENT)
Expand Down

0 comments on commit 147604c

Please sign in to comment.