-
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.
- Loading branch information
1 parent
387787d
commit 8e0b26b
Showing
44 changed files
with
752 additions
and
395 deletions.
There are no files selected for viewing
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
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
4 changes: 0 additions & 4 deletions
4
src/main/java/com/tukorea/planding/domain/group/dto/response/GroupScheduleResponse.java
This file was deleted.
Oops, something went wrong.
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
3 changes: 2 additions & 1 deletion
3
...n/java/com/tukorea/planding/domain/group/repository/normal/GroupRoomRepositoryCustom.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 |
---|---|---|
@@ -1,12 +1,13 @@ | ||
package com.tukorea.planding.domain.group.repository.normal; | ||
|
||
import com.tukorea.planding.domain.group.entity.GroupRoom; | ||
import com.tukorea.planding.domain.schedule.entity.Schedule; | ||
import com.tukorea.planding.domain.user.entity.User; | ||
|
||
import java.util.List; | ||
|
||
public interface GroupRoomRepositoryCustom { | ||
List<GroupRoom> findGroupRoomsByUserId(Long userId); | ||
List<User> getGroupUsers(Long groupId); | ||
|
||
List<User> getGroupUsers(Long groupId); | ||
} |
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
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
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
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
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
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
26 changes: 26 additions & 0 deletions
26
src/main/java/com/tukorea/planding/domain/group/service/query/UserGroupQueryService.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,26 @@ | ||
package com.tukorea.planding.domain.group.service.query; | ||
|
||
import com.tukorea.planding.domain.group.entity.UserGroup; | ||
import com.tukorea.planding.domain.group.repository.usergroup.UserGroupRepository; | ||
import com.tukorea.planding.global.error.BusinessException; | ||
import com.tukorea.planding.global.error.ErrorCode; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class UserGroupQueryService { | ||
|
||
private final UserGroupRepository userGroupRepository; | ||
|
||
public void save(UserGroup userGroup) { | ||
userGroupRepository.save(userGroup); | ||
} | ||
|
||
public void checkUserAccessToGroupRoom(Long groupRoomId, Long userId) { | ||
boolean exists = userGroupRepository.existsByGroupRoomIdAndUserId(groupRoomId, userId); | ||
if (!exists) { | ||
throw new BusinessException(ErrorCode.ACCESS_DENIED); | ||
} | ||
} | ||
} |
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
49 changes: 49 additions & 0 deletions
49
src/main/java/com/tukorea/planding/domain/schedule/controller/CommonScheduleController.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,49 @@ | ||
package com.tukorea.planding.domain.schedule.controller; | ||
|
||
import com.tukorea.planding.common.CommonResponse; | ||
import com.tukorea.planding.common.CommonUtils; | ||
import com.tukorea.planding.domain.schedule.dto.request.ScheduleRequest; | ||
import com.tukorea.planding.domain.schedule.dto.response.PersonalScheduleResponse; | ||
import com.tukorea.planding.domain.schedule.dto.response.ScheduleResponse; | ||
import com.tukorea.planding.domain.schedule.service.CommonScheduleService; | ||
import com.tukorea.planding.domain.user.dto.UserInfo; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@Tag(name = "CommonSchedule", description = "공통 스케줄") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/common/schedule") | ||
public class CommonScheduleController { | ||
|
||
private final CommonScheduleService commonScheduleService; | ||
|
||
@Operation(summary = "오늘 스케줄 조회") | ||
@GetMapping("/today") | ||
public CommonResponse<List<ScheduleResponse>> showTodaySchedule(@AuthenticationPrincipal UserInfo userInfo) { | ||
List<ScheduleResponse> responses = commonScheduleService.showTodaySchedule(userInfo); | ||
return CommonUtils.success(responses); | ||
} | ||
|
||
@Operation(summary = "공통: 스케쥴 생성을 할 때 내가 포함된 모든 그룹, 개인 시간때에 스케쥴을 확인") | ||
@PostMapping("/overlap") | ||
public CommonResponse<List<ScheduleResponse>> findOverlapSchedule(@AuthenticationPrincipal UserInfo userInfo, @RequestBody ScheduleRequest scheduleRequest) { | ||
List<ScheduleResponse> scheduleResponses = commonScheduleService.findOverlapSchedule(userInfo.getId(), scheduleRequest); | ||
return CommonUtils.success(scheduleResponses); | ||
} | ||
|
||
@Operation(summary = "주간으로 가져오기") | ||
@GetMapping("/week/{startDate}/{endDate}") | ||
public CommonResponse<List<ScheduleResponse>> getWeekSchedule(@PathVariable(name = "startDate") LocalDate startDate, | ||
@PathVariable(name = "endDate") LocalDate endDate | ||
, @AuthenticationPrincipal UserInfo userInfo) { | ||
List<ScheduleResponse> scheduleResponse = commonScheduleService.getWeekSchedule(startDate, endDate, userInfo); | ||
return CommonUtils.success(scheduleResponse); | ||
} | ||
} |
12 changes: 6 additions & 6 deletions
12
...va/com/tukorea/planding/domain/schedule/controller/GroupScheduleAttendanceController.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
57 changes: 57 additions & 0 deletions
57
...main/java/com/tukorea/planding/domain/schedule/controller/PersonalScheduleController.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,57 @@ | ||
package com.tukorea.planding.domain.schedule.controller; | ||
|
||
import com.tukorea.planding.common.CommonResponse; | ||
import com.tukorea.planding.common.CommonUtils; | ||
import com.tukorea.planding.domain.schedule.dto.response.PersonalScheduleResponse; | ||
import com.tukorea.planding.domain.schedule.service.PersonalScheduleService; | ||
import com.tukorea.planding.domain.user.dto.UserInfo; | ||
import com.tukorea.planding.domain.schedule.dto.request.ScheduleRequest; | ||
import com.tukorea.planding.domain.schedule.dto.response.ScheduleResponse; | ||
import io.swagger.v3.oas.annotations.Operation; | ||
import io.swagger.v3.oas.annotations.tags.Tag; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.security.core.annotation.AuthenticationPrincipal; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
@Tag(name = "PersonalSchedule", description = "개인 스케줄") | ||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/api/v1/schedule") | ||
public class PersonalScheduleController { | ||
|
||
private final PersonalScheduleService personalScheduleService; | ||
|
||
@Operation(summary = "개인 스케줄: 생성") | ||
@PostMapping() | ||
public CommonResponse<PersonalScheduleResponse> createSchedule(@AuthenticationPrincipal UserInfo userInfo, @RequestBody ScheduleRequest scheduleRequest) { | ||
PersonalScheduleResponse response = personalScheduleService.createSchedule(userInfo, scheduleRequest); | ||
return CommonUtils.success(response); | ||
} | ||
|
||
@Operation(summary = "개인 스케줄: 삭제") | ||
@DeleteMapping("/{id}") | ||
public ResponseEntity<PersonalScheduleResponse> deleteSchedule(@AuthenticationPrincipal UserInfo userInfo, @PathVariable Long id) { | ||
personalScheduleService.deleteSchedule(userInfo, id); | ||
return new ResponseEntity<>(HttpStatus.OK); | ||
} | ||
|
||
@Operation(summary = "개인 스케줄: 조회") | ||
@GetMapping("/{schedule_id}") | ||
public CommonResponse<PersonalScheduleResponse> getScheduleById(@PathVariable(name = "schedule_id") Long id, @AuthenticationPrincipal UserInfo userInfo) { | ||
PersonalScheduleResponse scheduleResponse = personalScheduleService.getSchedule(id, userInfo); | ||
return CommonUtils.success(scheduleResponse); | ||
} | ||
|
||
//TODO 아직 요구사항 미정 | ||
@Operation(summary = "개인 스케줄: 제목,내용,시작시간,끝낼시간 항목 수정") | ||
@PatchMapping("/{schedule_id}") | ||
public CommonResponse<PersonalScheduleResponse> updateSchedule(@PathVariable(name = "schedule_id") Long id, @RequestBody ScheduleRequest scheduleRequest, @AuthenticationPrincipal UserInfo userInfo) { | ||
PersonalScheduleResponse scheduleResponse = personalScheduleService.updateSchedule(id, scheduleRequest, userInfo); | ||
return CommonUtils.success(scheduleResponse); | ||
} | ||
} |
Oops, something went wrong.