-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEAT] 스케줄 API 구현
- Loading branch information
Showing
10 changed files
with
531 additions
and
1 deletion.
There are no files selected for viewing
75 changes: 75 additions & 0 deletions
75
src/main/java/com/umc/networkingService/domain/schedule/controller/ScheduleController.java
This file contains 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,75 @@ | ||
package com.umc.networkingService.domain.schedule.controller; | ||
|
||
import com.umc.networkingService.config.security.auth.CurrentMember; | ||
import com.umc.networkingService.domain.member.entity.Member; | ||
import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.CreateSchedule; | ||
import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.UpdateSchedule; | ||
import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleDetail; | ||
import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleId; | ||
import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummariesInCalendar; | ||
import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleInfoSummaryLists; | ||
import com.umc.networkingService.domain.schedule.service.ScheduleService; | ||
import com.umc.networkingService.global.common.base.BaseResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import jakarta.validation.Valid; | ||
import java.time.LocalDate; | ||
import java.util.UUID; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RequestParam; | ||
import org.springframework.web.bind.annotation.RequestPart; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Tag(name = "일정 API", description = "일정 관련 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/schedules") | ||
public class ScheduleController { | ||
|
||
private final ScheduleService scheduleService; | ||
|
||
// GET | ||
@Operation(summary = "일정 조회(Web) - 중앙, 지부, 학교", description = "홈화면의 일정을 조회하는 API입니다.") | ||
@GetMapping | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "성공") | ||
}) | ||
public BaseResponse<ScheduleInfoSummaryLists> getScheduleLists(@RequestParam LocalDate date) { | ||
|
||
return BaseResponse.onSuccess((scheduleService.getScheduleLists(date))); | ||
} | ||
|
||
@Operation(summary = "일정 조회(상세조회)", description = "홈화면의 달력에서 일정을 상세조회하는 API입니다.") | ||
@GetMapping("/detail/{scheduleId}") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "SCHEDULE001", description = "존재하지 않은 스케줄입니다.") | ||
}) | ||
public BaseResponse<ScheduleDetail> getScheduleDetail(@CurrentMember Member member, | ||
@PathVariable("scheduleId") UUID scheduleId) { | ||
|
||
return BaseResponse.onSuccess(scheduleService.getScheduleDetail(member, scheduleId)); | ||
} | ||
|
||
// POST | ||
|
||
@Operation(summary = "캘린더 조회 API", description = "홈 화면의 달력을 조회하는 API입니다.") | ||
@PostMapping("/calendar") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "성공") | ||
}) | ||
public BaseResponse<ScheduleInfoSummariesInCalendar> getSchedule(@RequestParam LocalDate date) { | ||
|
||
return BaseResponse.onSuccess(scheduleService.getCalendarByMonth(date)); | ||
} | ||
|
||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...in/java/com/umc/networkingService/domain/schedule/controller/StaffScheduleController.java
This file contains 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,69 @@ | ||
package com.umc.networkingService.domain.schedule.controller; | ||
|
||
import com.umc.networkingService.config.security.auth.CurrentMember; | ||
import com.umc.networkingService.domain.member.entity.Member; | ||
import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.CreateSchedule; | ||
import com.umc.networkingService.domain.schedule.dto.request.ScheduleRequest.UpdateSchedule; | ||
import com.umc.networkingService.domain.schedule.dto.response.ScheduleResponse.ScheduleId; | ||
import com.umc.networkingService.domain.schedule.service.ScheduleService; | ||
import com.umc.networkingService.global.common.base.BaseResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponse; | ||
import io.swagger.v3.oas.annotations.responses.ApiResponses; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import java.util.UUID; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.web.bind.annotation.DeleteMapping; | ||
import org.springframework.web.bind.annotation.PathVariable; | ||
import org.springframework.web.bind.annotation.PostMapping; | ||
import org.springframework.web.bind.annotation.RequestBody; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
@Tag(name = "운영진 스케줄 API", description = "운영진 스케줄 관련 API") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/staff/schedules") | ||
public class StaffScheduleController { | ||
|
||
private final ScheduleService scheduleService; | ||
|
||
@Operation(summary = "일정 추가 API", description = "운영진 관리 페이지의 일정을 추가하는 API입니다.") | ||
@PostMapping | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "성공") | ||
}) | ||
public BaseResponse<ScheduleId> createSchedule(@CurrentMember Member member, | ||
@RequestBody CreateSchedule request) { | ||
|
||
return BaseResponse.onSuccess(scheduleService.createSchedule(member, request)); | ||
} | ||
|
||
@Operation(summary = "일정 수정 API", description = "운영진 관리 페이지의 일정을 수정하는 API입니다.") | ||
@PostMapping("/update/{scheduleId}") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "SCHEDULE001", description = "존재하지 않은 스케줄입니다.") | ||
}) | ||
public BaseResponse<ScheduleId> updateSchedule(@CurrentMember Member member, | ||
@PathVariable("scheduleId") UUID scheduleId, | ||
@RequestBody UpdateSchedule request) { | ||
|
||
return BaseResponse.onSuccess(scheduleService.updateSchedule(member, scheduleId, request)); | ||
} | ||
|
||
// DELETE | ||
|
||
@Operation(summary = "일정 삭제 API", description = "운영진 관리 페이지의 일정을 삭제하는 API입니다.") | ||
@DeleteMapping("/{scheduleId}") | ||
@ApiResponses(value = { | ||
@ApiResponse(responseCode = "200", description = "성공"), | ||
@ApiResponse(responseCode = "SCHEDULE001", description = "존재하지 않은 스케줄입니다.") | ||
}) | ||
public BaseResponse<ScheduleId> deleteSchedule(@CurrentMember Member member, | ||
@PathVariable("scheduleId") UUID scheduleId) { | ||
|
||
return BaseResponse.onSuccess(scheduleService.deleteSchedule(member, scheduleId)); | ||
} | ||
|
||
} |
40 changes: 40 additions & 0 deletions
40
src/main/java/com/umc/networkingService/domain/schedule/dto/request/ScheduleRequest.java
This file contains 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,40 @@ | ||
package com.umc.networkingService.domain.schedule.dto.request; | ||
|
||
import com.umc.networkingService.domain.board.entity.HostType; | ||
import com.umc.networkingService.global.common.enums.Semester; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
public class ScheduleRequest { | ||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public static class CreateSchedule { | ||
private String title; | ||
private String content; | ||
private LocalDateTime startDateTime; | ||
private LocalDateTime endDateTime; | ||
private List<Semester> semesterPermission; | ||
private HostType hostType; | ||
private String placeSetting; | ||
} | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public static class UpdateSchedule { | ||
private String title; | ||
private String content; | ||
private LocalDateTime startDateTime; | ||
private LocalDateTime endDateTime; | ||
private List<Semester> semesterPermission; | ||
private HostType hostType; | ||
private String placeSetting; | ||
} | ||
} |
85 changes: 85 additions & 0 deletions
85
src/main/java/com/umc/networkingService/domain/schedule/dto/response/ScheduleResponse.java
This file contains 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,85 @@ | ||
package com.umc.networkingService.domain.schedule.dto.response; | ||
|
||
import com.umc.networkingService.domain.board.entity.HostType; | ||
import com.umc.networkingService.domain.member.entity.Member; | ||
import com.umc.networkingService.domain.member.entity.PositionType; | ||
import com.umc.networkingService.global.common.enums.Role; | ||
import com.umc.networkingService.global.common.enums.Semester; | ||
import java.time.LocalDateTime; | ||
import java.util.List; | ||
import java.util.UUID; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
public class ScheduleResponse { | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public static class ScheduleInfoSummaryInCalendar { | ||
private UUID scheduleId; | ||
private LocalDateTime startDateTime; | ||
private LocalDateTime endDateTime; | ||
private String hostType; | ||
} | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public static class ScheduleInfoSummariesInCalendar { | ||
private List<ScheduleInfoSummaryInCalendar> schedules; | ||
} | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public static class ScheduleInfoSummary { | ||
private UUID scheduleId; | ||
private LocalDateTime startDateTime; | ||
private LocalDateTime endDatetime; | ||
private String title; | ||
private HostType hostType; | ||
} | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public static class ScheduleInfoSummaryLists { | ||
private List<ScheduleInfoSummary> campusSchedules; | ||
private List<ScheduleInfoSummary> branchSchedules; | ||
private List<ScheduleInfoSummary> centerSchedules; | ||
} | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public static class ScheduleId { | ||
private UUID scheduleId; | ||
} | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public static class ScheduleDetail { | ||
private UUID scheduleId; | ||
private String writerName; | ||
private String writerNickname; | ||
private String title; | ||
private String content; | ||
private LocalDateTime startDateTime; | ||
private LocalDateTime endDateTime; | ||
private String placeSetting; | ||
private HostType hostType; | ||
|
||
} | ||
|
||
|
||
} |
This file contains 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.