-
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
Open
seyeon22222
wants to merge
5
commits into
dev
Choose a base branch
from
1091-refactoring-admin-공유일정-조회-api---분류별-일정조회-api로-변경
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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"
Open
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
c0961f7
🔨 [Refactoring] Admin 공유일정 조회 API -> 분류별 일정조회 API로 변경
seyeon22222 0489b19
🔨 [Refactoring] if분기문 helper함수로 작성
seyeon22222 d02b734
✨ [Fix] SecurityConfig 수정
seyeon22222 8810f8d
✨ [Fix] SecurityConfig 수정
seyeon22222 21ac71b
[Fix] Proejct List 추가
seyeon22222 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
5 changes: 3 additions & 2 deletions
5
...alendar/api/admin/schedule/privateschedule/controller/PrivateScheduleAdminController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...gg/calendar/api/admin/schedule/totalschedule/controller/TotalScheduleAdminController.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
|
|
||
| PageResponseDto<TotalScheduleAdminResDto> pageResponseDto = totalScheduleAdminService.findAllByClassification( | ||
| detailClassification, page, size); | ||
|
|
||
| return ResponseEntity.ok(pageResponseDto); | ||
| } | ||
| } |
59 changes: 59 additions & 0 deletions
59
...lendar/api/admin/schedule/totalschedule/controller/response/TotalScheduleAdminResDto.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
.../java/gg/calendar/api/admin/schedule/totalschedule/service/TotalScheduleAdminService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"))); | ||
|
|
||
| Page<PublicSchedule> publicSchedules = publicScheduleAdminRepository.findAllByClassification( | ||
| detailClassification, pageable); | ||
|
|
||
| List<TotalScheduleAdminResDto> publicScheduleList = publicSchedules.stream() | ||
| .map(TotalScheduleAdminResDto::new) | ||
| .collect(Collectors.toList()); | ||
| return PageResponseDto.of(publicSchedules.getTotalElements(), publicScheduleList); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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