-
Notifications
You must be signed in to change notification settings - Fork 11
🔨 [Refactoring] Admin 공유일정 조회 API -> 분류별 일정조회 API로 변경 #1091 #1093
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
The head ref may contain hidden characters: "1091-refactoring-admin-\uACF5\uC720\uC77C\uC815-\uC870\uD68C-api---\uBD84\uB958\uBCC4-\uC77C\uC815\uC870\uD68C-api\uB85C-\uBCC0\uACBD"
Changes from all commits
c0961f7
0489b19
d02b734
8810f8d
21ac71b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,18 @@ | ||
| package gg.calendar.api.admin.schedule.privateschedule.controller; | ||
|
|
||
| import org.springframework.web.bind.annotation.PostMapping; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| import gg.calendar.api.admin.schedule.privateschedule.service.PrivateScheduleAdminService; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
|
|
||
| @Slf4j | ||
| @RestController | ||
| @RequiredArgsConstructor | ||
| @RequestMapping("/admin/calendar") | ||
| @RequestMapping("/admin/calendar/private") | ||
| public class PrivateScheduleAdminController { | ||
|
|
||
| private final PrivateScheduleAdminService privateScheduleAdminService; | ||
|
|
||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| package gg.calendar.api.admin.schedule.totalschedule.controller; | ||
|
|
||
| import javax.validation.Valid; | ||
|
|
||
| import org.springframework.http.ResponseEntity; | ||
| import org.springframework.web.bind.annotation.GetMapping; | ||
| import org.springframework.web.bind.annotation.ModelAttribute; | ||
| import org.springframework.web.bind.annotation.PathVariable; | ||
| import org.springframework.web.bind.annotation.RequestMapping; | ||
| import org.springframework.web.bind.annotation.RestController; | ||
|
|
||
| import gg.calendar.api.admin.schedule.totalschedule.controller.response.TotalScheduleAdminResDto; | ||
| import gg.calendar.api.admin.schedule.totalschedule.service.TotalScheduleAdminService; | ||
| import gg.data.calendar.type.DetailClassification; | ||
| import gg.utils.dto.PageRequestDto; | ||
| import gg.utils.dto.PageResponseDto; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @RestController | ||
| @RequiredArgsConstructor | ||
| @RequestMapping("/admin/calendar") | ||
| public class TotalScheduleAdminController { | ||
|
|
||
| private final TotalScheduleAdminService totalScheduleAdminService; | ||
|
|
||
| @GetMapping("/list/{detailClassification}") | ||
| public ResponseEntity<PageResponseDto<TotalScheduleAdminResDto>> totalScheduleAdminClassificationList( | ||
| @PathVariable DetailClassification detailClassification, @ModelAttribute @Valid PageRequestDto pageRequestDto) { | ||
| int page = pageRequestDto.getPage(); | ||
| int size = pageRequestDto.getSize(); | ||
|
Check warning on line 30 in gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/totalschedule/controller/TotalScheduleAdminController.java
|
||
|
|
||
| PageResponseDto<TotalScheduleAdminResDto> pageResponseDto = totalScheduleAdminService.findAllByClassification( | ||
|
Check warning on line 32 in gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/totalschedule/controller/TotalScheduleAdminController.java
|
||
| detailClassification, page, size); | ||
|
|
||
| return ResponseEntity.ok(pageResponseDto); | ||
|
Check warning on line 35 in gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/totalschedule/controller/TotalScheduleAdminController.java
|
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| package gg.calendar.api.admin.schedule.totalschedule.controller.response; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| import gg.data.calendar.PublicSchedule; | ||
| import gg.data.calendar.type.DetailClassification; | ||
| import gg.data.calendar.type.EventTag; | ||
| import gg.data.calendar.type.JobTag; | ||
| import gg.data.calendar.type.ScheduleStatus; | ||
| import gg.data.calendar.type.TechTag; | ||
| import lombok.AccessLevel; | ||
| import lombok.Builder; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
| public class TotalScheduleAdminResDto { | ||
|
|
||
| private Long id; | ||
|
|
||
| private DetailClassification classification; | ||
|
|
||
| private EventTag eventTag; | ||
|
|
||
| private JobTag jobTag; | ||
|
|
||
| private TechTag techTag; | ||
|
|
||
| private String author; | ||
|
|
||
| private String title; | ||
|
|
||
| private LocalDateTime startTime; | ||
|
|
||
| private LocalDateTime endTime; | ||
|
|
||
| private String link; | ||
|
|
||
| private Integer sharedCount; | ||
|
|
||
| private ScheduleStatus status; | ||
|
|
||
| @Builder | ||
| public TotalScheduleAdminResDto(PublicSchedule publicSchedule) { | ||
| this.id = publicSchedule.getId(); | ||
| this.classification = publicSchedule.getClassification(); | ||
| this.eventTag = publicSchedule.getEventTag(); | ||
| this.jobTag = publicSchedule.getJobTag(); | ||
| this.techTag = publicSchedule.getTechTag(); | ||
| this.author = publicSchedule.getAuthor(); | ||
| this.title = publicSchedule.getTitle(); | ||
| this.startTime = publicSchedule.getStartTime(); | ||
| this.endTime = publicSchedule.getEndTime(); | ||
| this.link = publicSchedule.getLink(); | ||
| this.sharedCount = publicSchedule.getSharedCount(); | ||
| this.status = publicSchedule.getStatus(); | ||
| } | ||
|
Check warning on line 58 in gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/totalschedule/controller/response/TotalScheduleAdminResDto.java
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package gg.calendar.api.admin.schedule.totalschedule.service; | ||
|
|
||
| import java.util.List; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import org.springframework.data.domain.Page; | ||
| import org.springframework.data.domain.PageRequest; | ||
| import org.springframework.data.domain.Pageable; | ||
| import org.springframework.data.domain.Sort; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import gg.admin.repo.calendar.PublicScheduleAdminRepository; | ||
| import gg.calendar.api.admin.schedule.totalschedule.controller.response.TotalScheduleAdminResDto; | ||
| import gg.data.calendar.PublicSchedule; | ||
| import gg.data.calendar.type.DetailClassification; | ||
| import gg.utils.dto.PageResponseDto; | ||
| import lombok.RequiredArgsConstructor; | ||
|
|
||
| @Service | ||
| @RequiredArgsConstructor | ||
| @Transactional(readOnly = true) | ||
| public class TotalScheduleAdminService { | ||
|
|
||
| private final PublicScheduleAdminRepository publicScheduleAdminRepository; | ||
|
|
||
| public PageResponseDto<TotalScheduleAdminResDto> findAllByClassification(DetailClassification detailClassification, | ||
| int page, int size) { | ||
|
|
||
| Pageable pageable = PageRequest.of(page - 1, size, | ||
| Sort.by(Sort.Order.asc("status"), Sort.Order.asc("startTime"))); | ||
|
Check warning on line 31 in gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/totalschedule/service/TotalScheduleAdminService.java
|
||
|
|
||
| Page<PublicSchedule> publicSchedules = publicScheduleAdminRepository.findAllByClassification( | ||
|
Check warning on line 33 in gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/totalschedule/service/TotalScheduleAdminService.java
|
||
| detailClassification, pageable); | ||
|
|
||
| List<TotalScheduleAdminResDto> publicScheduleList = publicSchedules.stream() | ||
| .map(TotalScheduleAdminResDto::new) | ||
| .collect(Collectors.toList()); | ||
| return PageResponseDto.of(publicSchedules.getTotalElements(), publicScheduleList); | ||
|
Check warning on line 39 in gg-calendar-api/src/main/java/gg/calendar/api/admin/schedule/totalschedule/service/TotalScheduleAdminService.java
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
자바 11버전 collects