Skip to content
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

🔀 [Merge] Merge 8th to dev #1169

Merged
merged 24 commits into from
Feb 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3c96e8b
✨ [Feature] 개인 일정 상세조회 api #1060 (#1131)
taehyeon3 Jan 6, 2025
e74db2c
✨ [Feature] 전체일정 조회하기 dto, controller, service 생성 및 test 완료 #1128 (#1…
wonies Jan 6, 2025
11752a1
✨ [Feature] 전체일정 기간조회 api 생성 및 완료 #1062 (#1134)
wonies Jan 7, 2025
711ff6b
✨ [Feature] 관리자 페이지 일정 검색 API 추가 #1120 (#1133)
seyeon22222 Jan 7, 2025
006e447
✨ [Feature] Admin 페이지 전체일정 조회 #1074 (#1135)
seyeon22222 Jan 7, 2025
361c210
✨ [Feature] 개인일정 기간 조회 api #1061 (#1136)
taehyeon3 Jan 7, 2025
838fc46
✨ [Feature] 전체일정 개인일정에 추가 api 작성 #1064 (#1138)
wonies Jan 8, 2025
44c2d03
✨ [Feature] 개인일정 커스터 마이징 추가 api (#1140)
taehyeon3 Jan 8, 2025
c5deb00
🛠️ [Refactoring] PublicScheduleDto에 누락된 status정보 추가 #1141 (#1142)
wonies Jan 8, 2025
850983b
✨ [Feature] 개인일정 커스터 마이징 수정 api #1070 (#1143)
taehyeon3 Jan 8, 2025
2db6cdd
✨ [Feature] 개인일정 커스터 마이징 목록 조회 api #1071 (#1144)
taehyeon3 Jan 8, 2025
2d10ed0
✨ [Feature] 개인일정 커스터 마이징 삭제 api #1073 (#1145)
taehyeon3 Jan 9, 2025
73f1c89
✨ [Feature] 개인일정 커스터 마이징 API DTO 검증 로직 추가 #1146 (#1147)
taehyeon3 Jan 9, 2025
7524677
🔨 [Refactoring] calendar api 명세서 동기화 #1148 (#1150)
taehyeon3 Jan 9, 2025
b318476
🛠️ [Fix] 전체일정-개인일정 가져오기에서 누락된 sharedCount 추가부분 수정 (#1154)
wonies Jan 10, 2025
f58ae8f
🔨 [Refactoring] Admin 페이지 프론트 요청사항에 의한 변경사항 #1156 (#1157)
seyeon22222 Jan 21, 2025
5b9e049
✨ [Feature] 모니터링스레드 - 42api event받아오기 / 기간지난 이벤트 deactivate / slack봇 …
wonies Jan 24, 2025
dee8d6a
✨ [Feature] 8기 README 1차 업데이트
seyeon22222 Feb 17, 2025
aab4337
⚡️ [Feature] 42api 모니터링스레드에작업 #1151 (#1158)
wonies Feb 18, 2025
856e8c7
✨ [Feature] 모니터링스레드 변경사항 및 완료 #1158 (#1160)
wonies Feb 18, 2025
48094c3
[Fix] publicSchedule에서 privateSchedule불러오지 못하게, api수정 #1163 (#1166)
wonies Feb 27, 2025
756e447
🛠️ [REFACTOR] 개인 일정 기간 조회 응답 dto 수정 (#1167)
taehyeon3 Feb 27, 2025
f5eb227
🛠️ [REFACTOR] checkstyle 수정
Feb 27, 2025
c257689
Merge branch 'dev' into 8th
taehyeon3 Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,13 @@

private String groupColor;

private Long groupId;

@Builder
private PrivateSchedulePeriodResDto(Long id, DetailClassification classification, EventTag eventTag, JobTag jobTag,
TechTag techTag, String author, String title, String content, String link, ScheduleStatus status,
LocalDateTime startTime, LocalDateTime endTime, boolean alarm, String groupTitle, String groupColor) {
LocalDateTime startTime, LocalDateTime endTime, boolean alarm, String groupTitle, String groupColor,
Long groupId) {

Check warning on line 56 in gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/privateschedule/controller/response/PrivateSchedulePeriodResDto.java

View check run for this annotation

Codecov / codecov/patch

gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/privateschedule/controller/response/PrivateSchedulePeriodResDto.java#L56

Added line #L56 was not covered by tests
this.id = id;
this.classification = classification;
this.eventTag = eventTag;
Expand All @@ -66,6 +69,7 @@
this.alarm = alarm;
this.groupTitle = groupTitle;
this.groupColor = groupColor;
this.groupId = groupId;

Check warning on line 72 in gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/privateschedule/controller/response/PrivateSchedulePeriodResDto.java

View check run for this annotation

Codecov / codecov/patch

gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/privateschedule/controller/response/PrivateSchedulePeriodResDto.java#L72

Added line #L72 was not covered by tests
}

public static PrivateSchedulePeriodResDto toDto(PrivateSchedule privateSchedule, ScheduleGroup scheduleGroup) {
Expand All @@ -85,6 +89,7 @@
.alarm(privateSchedule.isAlarm())
.groupTitle(scheduleGroup.getTitle())
.groupColor(scheduleGroup.getBackgroundColor())
.groupId(scheduleGroup.getId())

Check warning on line 92 in gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/privateschedule/controller/response/PrivateSchedulePeriodResDto.java

View check run for this annotation

Codecov / codecov/patch

gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/privateschedule/controller/response/PrivateSchedulePeriodResDto.java#L92

Added line #L92 was not covered by tests
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import gg.calendar.api.user.schedule.publicschedule.controller.response.PublicScheduleUpdateResDto;
import gg.calendar.api.user.schedule.publicschedule.service.PublicScheduleService;
import gg.data.calendar.PublicSchedule;
import gg.data.calendar.type.DetailClassification;
import gg.utils.dto.ListResponseDto;
import io.swagger.v3.oas.annotations.Parameter;
import lombok.RequiredArgsConstructor;
Expand Down Expand Up @@ -76,15 +75,14 @@
return ResponseEntity.ok(PublicScheduleDetailRetrieveResDto.toDto(publicSchedule));
}

@GetMapping("/period/{detailClassification}")
@GetMapping
public ResponseEntity<ListResponseDto<PublicSchedulePeriodRetrieveResDto>> publicSchedulePeriodRetrieveGet(
@PathVariable DetailClassification detailClassification,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate start,
@RequestParam @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate end) {
LocalDateTime startTime = start.atStartOfDay();
LocalDateTime endTime = end.atTime(LocalTime.MAX);
List<PublicSchedulePeriodRetrieveResDto> res = publicScheduleService.retrievePublicSchedulePeriod(
startTime, endTime, detailClassification);
List<PublicSchedulePeriodRetrieveResDto> res = publicScheduleService.retrieveNonPrivateSchedulePeriod(

Check warning on line 84 in gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/publicschedule/controller/PublicScheduleController.java

View check run for this annotation

Codecov / codecov/patch

gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/publicschedule/controller/PublicScheduleController.java#L84

Added line #L84 was not covered by tests
startTime, endTime);
return ResponseEntity.ok(ListResponseDto.toDto(res));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@
return publicRetrieveSchedule;
}

public List<PublicSchedulePeriodRetrieveResDto> retrievePublicSchedulePeriod(LocalDateTime start, LocalDateTime end,
DetailClassification classification) {
public List<PublicSchedulePeriodRetrieveResDto> retrieveNonPrivateSchedulePeriod(LocalDateTime start,
LocalDateTime end) {
validateTimeRange(start, end);
List<PublicSchedule> classSchedules = publicScheduleRepository
.findByEndTimeGreaterThanEqualAndStartTimeLessThanEqualAndClassification(
start, end, classification);
return classSchedules.stream().map(PublicSchedulePeriodRetrieveResDto::toDto).collect(Collectors.toList());
List<PublicSchedule> nonPrivateSchedules = publicScheduleRepository
.findByEndTimeGreaterThanEqualAndStartTimeLessThanEqualAndClassificationNot(

Check warning on line 101 in gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/publicschedule/service/PublicScheduleService.java

View check run for this annotation

Codecov / codecov/patch

gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/publicschedule/service/PublicScheduleService.java#L100-L101

Added lines #L100 - L101 were not covered by tests
start, end, DetailClassification.PRIVATE_SCHEDULE);
return nonPrivateSchedules.stream().map(PublicSchedulePeriodRetrieveResDto::toDto).collect(Collectors.toList());

Check warning on line 103 in gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/publicschedule/service/PublicScheduleService.java

View check run for this annotation

Codecov / codecov/patch

gg-calendar-api/src/main/java/gg/calendar/api/user/schedule/publicschedule/service/PublicScheduleService.java#L103

Added line #L103 was not covered by tests
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ void retrievePublicScheduleDetailFailNotExist() throws Exception {
@DisplayName("공유일정기간조회")
class RetrievePublicScheduleByPeriod {
@Test
@DisplayName("[200]공개일정 event 기간조회성공")
@DisplayName("[200]공개일정 기간조회성공 (비공개일정 제외)")
void retrievePublicScheduleByEventPeriodSuccess() throws Exception {
//given
mockData.createPublicScheduleEvent(7);
Expand All @@ -894,16 +894,19 @@ void retrievePublicScheduleByEventPeriodSuccess() throws Exception {
LocalDateTime end = LocalDateTime.now().plusDays(7);
//when
mockMvc.perform(
get("/calendar/public/period/{detail_classification}", detailClassification).header("Authorization",
get("/calendar/public", detailClassification).header("Authorization",
"Bearer " + accessToken)
.param("start", start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.param("end", end.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.andExpect(status().isOk())
.andDo(print());

//then
assertThat(publicScheduleRepository.findAll()).hasSize(7);
assertThat(publicScheduleRepository.findAll()).extracting("classification")
List<PublicSchedule> allSchedules = publicScheduleRepository.findAll();
assertThat(allSchedules).hasSize(7); // Total of 5 EVENT + 2 OTHER_TYPE

// Verify classifications of returned schedules
assertThat(allSchedules).extracting("classification")
.containsOnly(DetailClassification.EVENT);
}

Expand All @@ -917,7 +920,7 @@ void retrievePublicScheduleByJobPeriodSuccess() throws Exception {
LocalDateTime end = LocalDateTime.now().plusDays(7);
//when
mockMvc.perform(
get("/calendar/public/period/{detail_classification}",
get("/calendar/public",
detailClassification).header("Authorization",
"Bearer " + accessToken).param("start",
start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
Expand All @@ -940,7 +943,7 @@ void retrievePublicScheduleFailFaultPeriod() throws Exception {
LocalDateTime end = LocalDateTime.now().minusDays(7);
//when & then
mockMvc.perform(
get("/calendar/public/period/{detail_classification}",
get("/calendar/public",
detailClassification).header("Authorization",
"Bearer " + accessToken).param("start",
start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
Expand All @@ -949,27 +952,6 @@ void retrievePublicScheduleFailFaultPeriod() throws Exception {
.andDo(print());
}

@Test
@DisplayName("[400]공개일정 조회실패 - 잘못된 detail_classification 이 들어왔을 때")
void retrievePublicScheduleFaultDetailClassification() throws Exception {
// given
mockData.createPublicScheduleEvent(7);
LocalDateTime start = LocalDateTime.now().plusDays(0);
LocalDateTime end = LocalDateTime.now().plusDays(7);
//when & then
mockMvc.perform(get("/calendar/public/period/{detail_classification}", "wrong")
.header("Authorization",
"Bearer " + accessToken).param("start", start.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
.param("end", end.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))))
.andExpect(status().isBadRequest())
.andExpect(result -> {
// 에러 응답의 세부 내용 출력
System.out.println("Response Body: " + result.getResponse().getContentAsString());
System.out.println("Status Code: " + result.getResponse().getStatus());
})
.andDo(print());
}

@Test
@DisplayName("[400]공개일정 조회실패 - 날짜형식이 잘못된 경우")
void retrievePublicScheduleFaultDateFormat() throws Exception {
Expand All @@ -980,7 +962,7 @@ void retrievePublicScheduleFaultDateFormat() throws Exception {
LocalDateTime end = LocalDateTime.now().plusDays(7);
//when & then
mockMvc.perform(
get("/calendar/public/period/{detail_classification}",
get("/calendar/public/",
detailClassification).header("Authorization",
"Bearer " + accessToken).param("start",
start.format(DateTimeFormatter.ofPattern("yyyy/MM/dd")))
Expand Down
2 changes: 1 addition & 1 deletion gg-pingpong-api/src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ info:
web:
coalitionUrl: 'https://api.intra.42.fr/v2/users/{id}/coalitions'
pointHistoryUrl: 'https://api.intra.42.fr/v2/users/{id}/correction_point_historics?sort=-id'

constant:
allowedMinimalStartDays: 2
tournamentSchedule: "0 0 0 * * *"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ List<PublicSchedule> findByEndTimeGreaterThanEqualAndStartTimeLessThanEqual(Loca
List<PublicSchedule> findByEndTimeGreaterThanEqualAndStartTimeLessThanEqualAndClassification(
LocalDateTime startTime, LocalDateTime endTime, DetailClassification classification);

List<PublicSchedule> findByEndTimeGreaterThanEqualAndStartTimeLessThanEqualAndClassificationNot(
LocalDateTime start, LocalDateTime end, DetailClassification classification);

boolean existsByTitleAndStartTime(String title, LocalDateTime beginAt);

@Modifying(clearAutomatically = true)
Expand Down