Skip to content

Commit 7ff52e7

Browse files
committed
♻️refactor: 모임 http method 일부 수정 및 테스트 .http 개선[#158]
/attend, /left 처럼 동사 엔드포인트를 이미 쓰고 있음 승인/거절/강퇴/차단/해제도 커맨드라서 POST가 자연스럽고, 실제로 많이 씀 장점: 프론트/테스트(.http)와 UX 흐름이 깔끔, 문서도 지금 스타일 그대로 확장 가능 특히 너는 이미 “행위 엔드포인트”를 채택했기 때문에, approve/reject/kick/ban/unban을 PATCH로 바꾸면 오히려 일관성이 깨져요. 그래서 여기서는 이렇게 정리할게요: - 참여/나가기/승인/거절/강퇴/차단/해제 모두 POST로 통일 - 조회(getKickTargets/getBanTargets/getBannedTargets)는 GET 유지
1 parent baf0935 commit 7ff52e7

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

src/main/java/team/wego/wegobackend/group/v2/presentation/GroupV2Controller.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public ResponseEntity<Void> delete(
174174
}
175175

176176

177-
@PatchMapping("/{groupId}/attendance/{targetUserId}/approve")
177+
@PostMapping("/{groupId}/attendance/{targetUserId}/approve")
178178
public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> approve(
179179
@AuthenticationPrincipal CustomUserDetails userDetails,
180180
@PathVariable Long groupId,
@@ -186,7 +186,7 @@ public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> approve(
186186
return ResponseEntity.ok(ApiResponse.success(HttpStatus.OK.value(), response));
187187
}
188188

189-
@PatchMapping("/{groupId}/attendance/{targetUserId}/reject")
189+
@PostMapping("/{groupId}/attendance/{targetUserId}/reject")
190190
public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> reject(
191191
@AuthenticationPrincipal CustomUserDetails userDetails,
192192
@PathVariable Long groupId,
@@ -198,7 +198,7 @@ public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> reject(
198198
return ResponseEntity.ok(ApiResponse.success(HttpStatus.OK.value(), response));
199199
}
200200

201-
@PatchMapping("/{groupId}/attendance/{targetUserId}/kick")
201+
@PostMapping("/{groupId}/attendance/{targetUserId}/kick")
202202
public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> kick(
203203
@AuthenticationPrincipal CustomUserDetails userDetails,
204204
@PathVariable Long groupId,
@@ -210,7 +210,7 @@ public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> kick(
210210
return ResponseEntity.ok(ApiResponse.success(HttpStatus.OK.value(), response));
211211
}
212212

213-
@PatchMapping("/{groupId}/attendance/{targetUserId}/ban")
213+
@PostMapping("/{groupId}/attendance/{targetUserId}/ban")
214214
public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> ban(
215215
@AuthenticationPrincipal CustomUserDetails userDetails,
216216
@PathVariable Long groupId,
@@ -222,7 +222,7 @@ public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> ban(
222222
return ResponseEntity.ok(ApiResponse.success(HttpStatus.OK.value(), response));
223223
}
224224

225-
@PatchMapping("/{groupId}/attendance/{targetUserId}/unban")
225+
@PostMapping("/{groupId}/attendance/{targetUserId}/unban")
226226
public ResponseEntity<ApiResponse<GroupUserV2StatusResponse>> unban(
227227
@AuthenticationPrincipal CustomUserDetails userDetails,
228228
@PathVariable Long groupId,

src/test/http/group/v2/v2-group-approve-reject.http

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,35 +149,35 @@ GET http://localhost:8080/api/v2/groups/{{ap_groupId}}
149149
Authorization: Bearer {{ap_hostAccessToken}}
150150

151151
### 6-1. HOST가 MEMBER1 승인 (PENDING -> ATTEND)
152-
PATCH http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member1UserId}}/approve
152+
POST http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member1UserId}}/approve
153153
Content-Type: application/json
154154
Authorization: Bearer {{ap_hostAccessToken}}
155155

156156
{}
157157

158158
### 6-2. HOST가 MEMBER2 거절 (PENDING -> REJECTED)
159-
PATCH http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member2UserId}}/reject
159+
POST http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member2UserId}}/reject
160160
Content-Type: application/json
161161
Authorization: Bearer {{ap_hostAccessToken}}
162162

163163
{}
164164

165165
### 7-1. 예외: MEMBER1을 다시 approve 시도 (이미 ATTEND -> PENDING 아님)
166-
PATCH http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member1UserId}}/approve
166+
POST http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member1UserId}}/approve
167167
Content-Type: application/json
168168
Authorization: Bearer {{ap_hostAccessToken}}
169169

170170
{}
171171

172172
### 7-2. 예외: MEMBER2를 다시 reject 시도 (이미 REJECTED -> PENDING 아님)
173-
PATCH http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member2UserId}}/reject
173+
POST http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member2UserId}}/reject
174174
Content-Type: application/json
175175
Authorization: Bearer {{ap_hostAccessToken}}
176176

177177
{}
178178

179179
### 8-1. 예외: MEMBER가 approve 호출 (권한 없음)
180-
PATCH http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member2UserId}}/approve
180+
POST http://localhost:8080/api/v2/groups/{{ap_groupId}}/attendance/{{ap_member2UserId}}/approve
181181
Content-Type: application/json
182182
Authorization: Bearer {{ap_member1AccessToken}}
183183

src/test/http/group/v2/v2-group-ban-unban.http

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,21 @@ GET http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/ban-targets
153153
Authorization: Bearer {{ban_member1AccessToken}}
154154

155155
### 6-1. HOST가 MEMBER1 ban (ATTEND -> BANNED)
156-
PATCH http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_member1UserId}}/ban
156+
POST http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_member1UserId}}/ban
157157
Content-Type: application/json
158158
Authorization: Bearer {{ban_hostAccessToken}}
159159

160160
{}
161161

162162
### 6-2. 예외: MEMBER2가 MEMBER1 ban 시도 (권한 없음)
163-
PATCH http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_member1UserId}}/ban
163+
POST http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_member1UserId}}/ban
164164
Content-Type: application/json
165165
Authorization: Bearer {{ban_member2AccessToken}}
166166

167167
{}
168168

169169
### 6-3. 예외: HOST가 HOST 자신 ban 시도
170-
PATCH http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_hostUserId}}/ban
170+
POST http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_hostUserId}}/ban
171171
Content-Type: application/json
172172
Authorization: Bearer {{ban_hostAccessToken}}
173173

@@ -189,21 +189,21 @@ Authorization: Bearer {{ban_member1AccessToken}}
189189
{}
190190

191191
### 9-1. HOST가 MEMBER1 unban (BANNED -> KICKED 기대)
192-
PATCH http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_member1UserId}}/unban
192+
POST http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_member1UserId}}/unban
193193
Content-Type: application/json
194194
Authorization: Bearer {{ban_hostAccessToken}}
195195

196196
{}
197197

198198
### 9-2. 예외: MEMBER2가 unban 시도 (권한 없음)
199-
PATCH http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_member1UserId}}/unban
199+
POST http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_member1UserId}}/unban
200200
Content-Type: application/json
201201
Authorization: Bearer {{ban_member2AccessToken}}
202202

203203
{}
204204

205205
### 9-3. 예외: HOST가 HOST unban 시도 (대상 host 불가)
206-
PATCH http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_hostUserId}}/unban
206+
POST http://localhost:8080/api/v2/groups/{{ban_groupId}}/attendance/{{ban_hostUserId}}/unban
207207
Content-Type: application/json
208208
Authorization: Bearer {{ban_hostAccessToken}}
209209

src/test/http/group/v2/v2-group-kick-targets.http

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ Authorization: Bearer {{kt_member2AccessToken}}
145145
{}
146146

147147
### 5-1. HOST가 kick 대상 조회 (kick-targets) - 성공 기대 (HOST 제외 ATTEND 멤버들)
148-
PATCH http://localhost:8080/api/v2/groups/{{kt_groupId}}/attendance/kick-targets
148+
POST http://localhost:8080/api/v2/groups/{{kt_groupId}}/attendance/kick-targets
149149
Authorization: Bearer {{kt_hostAccessToken}}
150150

151151
### 5-2. 예외: MEMBER가 kick-targets 조회 (HOST only)
152-
PATCH http://localhost:8080/api/v2/groups/{{kt_groupId}}/attendance/kick-targets
152+
POST http://localhost:8080/api/v2/groups/{{kt_groupId}}/attendance/kick-targets
153153
Authorization: Bearer {{kt_member1AccessToken}}
154154

155155
### 6-1. (선택) 참여자 없는 새 모임 생성 -> kick-targets 빈 배열 확인

src/test/http/group/v2/v2-group-kick.http

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,28 +153,28 @@ GET http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/kick-targets
153153
Authorization: Bearer {{kick_member1AccessToken}}
154154

155155
### 6-1. HOST가 MEMBER1 kick (ATTEND -> KICKED)
156-
PATCH http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/{{kick_member1UserId}}/kick
156+
POST http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/{{kick_member1UserId}}/kick
157157
Content-Type: application/json
158158
Authorization: Bearer {{kick_hostAccessToken}}
159159

160160
{}
161161

162162
### 6-2. 예외: MEMBER2가 MEMBER1 kick 시도 (권한 없음)
163-
PATCH http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/{{kick_member1UserId}}/kick
163+
POST http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/{{kick_member1UserId}}/kick
164164
Content-Type: application/json
165165
Authorization: Bearer {{kick_member2AccessToken}}
166166

167167
{}
168168

169169
### 6-3. 예외: HOST가 HOST 자신 kick 시도
170-
PATCH http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/{{kick_hostUserId}}/kick
170+
POST http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/{{kick_hostUserId}}/kick
171171
Content-Type: application/json
172172
Authorization: Bearer {{kick_hostAccessToken}}
173173

174174
{}
175175

176176
### 7-1. 예외: 이미 KICKED인 MEMBER1 다시 kick 시도 (status not allowed)
177-
PATCH http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/{{kick_member1UserId}}/kick
177+
POST http://localhost:8080/api/v2/groups/{{kick_groupId}}/attendance/{{kick_member1UserId}}/kick
178178
Content-Type: application/json
179179
Authorization: Bearer {{kick_hostAccessToken}}
180180

0 commit comments

Comments
 (0)