12
12
import com .sponus .coredomain .domain .propose .repository .ProposeRepository ;
13
13
import com .sponus .sponusbe .domain .organization .dto .request .PageCondition ;
14
14
import com .sponus .sponusbe .domain .organization .dto .response .PageResponse ;
15
- import com .sponus .sponusbe .domain .propose .dto .response .ProposeGetResponse ;
15
+ import com .sponus .sponusbe .domain .propose .dto .response .ReceiveProposeGetResponse ;
16
+ import com .sponus .sponusbe .domain .propose .dto .response .SendProposeGetResponse ;
16
17
17
18
import lombok .RequiredArgsConstructor ;
18
19
@@ -23,16 +24,30 @@ public class ProposeQueryService {
23
24
24
25
private final ProposeRepository proposeRepository ;
25
26
26
- public PageResponse <ProposeGetResponse > getSendPropose (Organization organization , PageCondition pageCondition ) {
27
+ public PageResponse <SendProposeGetResponse > getSendPropose (Organization organization , PageCondition pageCondition ) {
27
28
Pageable pageable = PageRequest .of (pageCondition .getPage () - 1 , pageCondition .getSize ());
28
- List <ProposeGetResponse > organizations = proposeRepository .findByOrganizationOrderByCreatedAtDesc (
29
+ List <SendProposeGetResponse > organizations = proposeRepository .findByOrganizationOrderByCreatedAtDesc (
29
30
organization , pageable )
30
31
.stream ()
31
- .map (ProposeGetResponse ::from )
32
+ .map (SendProposeGetResponse ::from )
32
33
.toList ();
33
34
34
35
return PageResponse .of (
35
36
PageableExecutionUtils .getPage (organizations , pageable ,
36
37
() -> proposeRepository .countByOrganization (organization )));
37
38
}
39
+
40
+ public PageResponse <ReceiveProposeGetResponse > getReceivedPropose (Organization organization ,
41
+ PageCondition pageCondition ) {
42
+ Pageable pageable = PageRequest .of (pageCondition .getPage () - 1 , pageCondition .getSize ());
43
+ List <ReceiveProposeGetResponse > receivedProposes = proposeRepository .findByTargetOrderByCreatedAtDesc (
44
+ organization , pageable )
45
+ .stream ()
46
+ .map (ReceiveProposeGetResponse ::from )
47
+ .toList ();
48
+
49
+ return PageResponse .of (
50
+ PageableExecutionUtils .getPage (receivedProposes , pageable ,
51
+ () -> proposeRepository .countByTarget (organization )));
52
+ }
38
53
}
0 commit comments