-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAdminFeedController.java
More file actions
40 lines (34 loc) · 1.63 KB
/
AdminFeedController.java
File metadata and controls
40 lines (34 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package ddingdong.ddingdongBE.domain.feed.controller;
import ddingdong.ddingdongBE.domain.feed.api.AdminFeedApi;
import ddingdong.ddingdongBE.domain.feed.controller.dto.response.AdminClubFeedRankingResponse;
import ddingdong.ddingdongBE.domain.feed.controller.dto.response.AdminFeedRankingWinnerResponse;
import ddingdong.ddingdongBE.domain.feed.controller.dto.response.ClubMonthlyStatusResponse;
import ddingdong.ddingdongBE.domain.feed.service.FeedRankingService;
import ddingdong.ddingdongBE.domain.feed.service.dto.query.ClubMonthlyStatusQuery;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequiredArgsConstructor
@Validated
public class AdminFeedController implements AdminFeedApi {
private final FeedRankingService feedRankingService;
@Override
public List<AdminFeedRankingWinnerResponse> getMonthlyWinners(int year) {
return feedRankingService.getMonthlyWinners(year).stream()
.map(AdminFeedRankingWinnerResponse::from)
.toList();
}
@Override
public List<AdminClubFeedRankingResponse> getClubFeedRanking(int year, int month) {
return AdminClubFeedRankingResponse.from(
feedRankingService.getClubFeedRanking(year, month)
);
}
@Override
public ClubMonthlyStatusResponse getClubMonthlyStatus(Long clubId, int year, int month) {
ClubMonthlyStatusQuery query = feedRankingService.getClubMonthlyStatusByClubId(clubId, year, month);
return ClubMonthlyStatusResponse.from(query);
}
}