Skip to content

Commit e067036

Browse files
committed
feat: 받은 제안 목록 조회 기능 개발
1 parent 04c85cc commit e067036

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

api/src/main/java/com/sponus/sponusbe/domain/propose/controller/ProposeController.java

+8
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,12 @@ public ApiResponse<PageResponse<ProposeGetResponse>> getSendPropose(
4848
) {
4949
return ApiResponse.onSuccess(proposequeryService.getSendPropose(authOrganization, pageCondition));
5050
}
51+
52+
@GetMapping("/received")
53+
public ApiResponse<PageResponse<ProposeGetResponse>> getReceivedPropose(
54+
@AuthOrganization Organization authOrganization,
55+
@ModelAttribute @Valid PageCondition pageCondition
56+
) {
57+
return ApiResponse.onSuccess(proposequeryService.getReceivedPropose(authOrganization, pageCondition));
58+
}
5159
}

api/src/main/java/com/sponus/sponusbe/domain/propose/service/ProposeQueryService.java

+12
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,16 @@ public PageResponse<ProposeGetResponse> getSendPropose(Organization organization
3535
PageableExecutionUtils.getPage(organizations, pageable,
3636
() -> proposeRepository.countByOrganization(organization)));
3737
}
38+
39+
public PageResponse<ProposeGetResponse> getReceivedPropose(Organization organization, PageCondition pageCondition) {
40+
Pageable pageable = PageRequest.of(pageCondition.getPage() - 1, pageCondition.getSize());
41+
List<ProposeGetResponse> organizations = proposeRepository.findByTargetAndOrganizationOrderByCreatedAtDesc(
42+
organization, organization, pageable)
43+
.map(ProposeGetResponse::from)
44+
.toList();
45+
46+
return PageResponse.of(
47+
PageableExecutionUtils.getPage(organizations, pageable,
48+
() -> proposeRepository.countByTargetAndOrganization(organization, organization)));
49+
}
3850
}

core/core-domain/src/main/java/com/sponus/coredomain/domain/propose/repository/ProposeRepository.java

+5
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,9 @@ Long countProposesByOrganizationToday(@Param("organization") Organization organi
2424
Page<Propose> findByOrganizationOrderByCreatedAtDesc(Organization organization, Pageable pageable);
2525

2626
Long countByOrganization(Organization organization);
27+
28+
Page<Propose> findByTargetAndOrganizationOrderByCreatedAtDesc(Organization target, Organization organization,
29+
Pageable pageable);
30+
31+
Long countByTargetAndOrganization(Organization target, Organization organization);
2732
}

0 commit comments

Comments
 (0)