3030@ RequiredArgsConstructor
3131public class GroupController {
3232
33- public static final RequestStatus ACCEPTED = RequestStatus .ACCEPTED ;
34- public static final RequestStatus REJECTED = RequestStatus .REJECTED ;
35- public static final RequestStatus CANCELED = RequestStatus .CANCELED ;
36-
3733 private final GroupService groupService ;
3834 private final RelationService relationService ;
39- private final GroupJoinService groupJoinService ;
40- private final NotificationService notificationService ;
4135
4236 /// 그룹 CRUD
4337
@@ -50,8 +44,7 @@ public ApiResponse<List<GroupResponseDto>> getUsersGroups(@LoginUser Users login
5044 // 그룹 조회
5145 @ GetMapping ("/group/{groupId}" )
5246 public ApiResponse <GroupResponseDto > groupInfo (@ PathVariable Long groupId ) {
53- GroupResponseDto groupResponseDto = groupService .getGroupInfo (groupId );
54- return ApiResponse .ok (groupResponseDto );
47+ return ApiResponse .ok (groupService .getGroupInfo (groupId ));
5548 }
5649
5750 // 그룹 생성
@@ -67,68 +60,18 @@ public ApiResponse<GroupResponseDto> updateGroup(@Valid @PathVariable Long group
6760 return groupService .updateGroupInfo (groupId , groupUpdateRequestDto );
6861 }
6962
70- // 그룹 가입 요청 보내기
71- @ PostMapping ("/group/join/{groupId}" )
72- public ApiResponse <?> joinGroup (@ Valid @ PathVariable Long groupId ,
73- @ LoginUser Users loginUser ,
74- @ RequestBody GroupJoinRequestDto groupJoinRequestDto ) {
75- groupJoinService .joinGroupRequest (groupId , loginUser , groupJoinRequestDto );
76- notificationService .notifyGroupJoinRequest (groupId , loginUser );
77- return ApiResponse .ok ("그룹 가입 요청이 완료되었습니다." );
78- }
79-
8063 // 그룹 삭제
8164 @ DeleteMapping ("/group/{groupId}" )
8265 public ApiResponse <?> deleteGroup (@ PathVariable Long groupId ) {
8366 return groupService .deleteGroup (groupId );
8467 }
8568
86-
87- /// 그룹 가입
88-
89- // 그룹 가입 요청 수락
90- @ PostMapping ("/group/join/accept/{groupId}" )
91- public ApiResponse <?> acceptJoinRequest (@ PathVariable Long groupId , @ LoginUser Users loginUser ) {
92- groupJoinService .changeStatus (groupId , loginUser , ACCEPTED );
93- notificationService .notifyGroupJoinResult (groupId , loginUser );
94- return ApiResponse .ok ("그룹 가입 요청이 수락되었습니다." );
95- }
96-
97- // 그룹 가입 요청 거절
98- @ PostMapping ("/group/join/reject/{groupId}" )
99- public ApiResponse <?> rejectJoinRequest (@ PathVariable Long groupId , @ LoginUser Users loginUser ) {
100- groupJoinService .changeStatus (groupId , loginUser , REJECTED );
101- notificationService .notifyGroupJoinResult (groupId , loginUser );
102- return ApiResponse .ok ("그룹 가입 요청이 거절되었습니다." );
103- }
104-
105- // 그룹 가입 요청 취소
106- @ DeleteMapping ("/group/join/cancel/{groupId}" )
107- public ApiResponse <?> cancelJoinRequest (@ PathVariable Long groupId , @ LoginUser Users loginUser ) {
108- groupJoinService .changeStatus (groupId , loginUser , CANCELED );
109- return ApiResponse .ok ("그룹 가입 요청이 취소되었습니다." );
110- }
111-
112- // 그룹 가입 요청 조회
113- @ GetMapping ("/group/join/{groupId}" )
114- public ApiResponse <?> getJoinRequest (@ PathVariable Long groupId ) {
115- return groupJoinService .getJoinRequestList (groupId );
116- }
117-
118- // 그룹 떠나기 (탈퇴)
119- @ DeleteMapping ("/group/leave/{groupId}" )
120- public ApiResponse <?> leaveGroup (@ LoginUser Users loginUser , @ PathVariable Long groupId ) {
121- return relationService .leaveGroup (loginUser , groupId );
122- }
123-
124-
12569 /// 조회
12670
12771 // 그룹 멤버 조회
12872 @ GetMapping ("/group/members/{groupId}" )
12973 public ApiResponse <List <UserResponseDto >> groupMembers (@ PathVariable Long groupId ) {
130- List <UserResponseDto > members = groupService .getGroupMembers (groupId );
131- return ApiResponse .ok (members );
74+ return ApiResponse .ok (groupService .getGroupMembers (groupId ));
13275 }
13376
13477 // 그룹 관계 조회
0 commit comments