@@ -141,4 +141,260 @@ ResponseEntity<RsData<CommentResponse>> createComment(
141141 @ RequestBody CommentRequest request ,
142142 @ AuthenticationPrincipal CustomUserDetails user
143143 );
144+
145+ @ Operation (
146+ summary = "댓글 수정" ,
147+ description = "로그인한 사용자가 자신이 작성한 댓글을 수정합니다."
148+ )
149+ @ ApiResponses ({
150+ @ ApiResponse (
151+ responseCode = "200" ,
152+ description = "댓글 수정 성공" ,
153+ content = @ Content (
154+ mediaType = "application/json" ,
155+ examples = @ ExampleObject (value = """
156+ {
157+ "success": true,
158+ "code": "SUCCESS_200",
159+ "message": "댓글이 수정되었습니다.",
160+ "data": {
161+ "commentId": 25,
162+ "postId": 101,
163+ "author": {
164+ "id": 5,
165+ "nickname": "홍길동"
166+ },
167+ "content": "수정된 댓글 내용입니다.",
168+ "createdAt": "2025-09-22T11:30:00",
169+ "updatedAt": "2025-09-22T13:00:00"
170+ }
171+ }
172+ """ )
173+ )
174+ ),
175+ @ ApiResponse (
176+ responseCode = "400" ,
177+ description = "잘못된 요청 (필드 누락 등)" ,
178+ content = @ Content (
179+ mediaType = "application/json" ,
180+ examples = @ ExampleObject (value = """
181+ {
182+ "success": false,
183+ "code": "COMMON_400",
184+ "message": "잘못된 요청입니다.",
185+ "data": null
186+ }
187+ """ )
188+ )
189+ ),
190+ @ ApiResponse (
191+ responseCode = "401" ,
192+ description = "인증 실패 (토큰 없음/잘못됨/만료)" ,
193+ content = @ Content (
194+ mediaType = "application/json" ,
195+ examples = {
196+ @ ExampleObject (name = "토큰 없음" , value = """
197+ {
198+ "success": false,
199+ "code": "AUTH_001",
200+ "message": "인증이 필요합니다.",
201+ "data": null
202+ }
203+ """ ),
204+ @ ExampleObject (name = "잘못된 토큰" , value = """
205+ {
206+ "success": false,
207+ "code": "AUTH_002",
208+ "message": "유효하지 않은 액세스 토큰입니다.",
209+ "data": null
210+ }
211+ """ ),
212+ @ ExampleObject (name = "만료된 토큰" , value = """
213+ {
214+ "success": false,
215+ "code": "AUTH_004",
216+ "message": "만료된 액세스 토큰입니다.",
217+ "data": null
218+ }
219+ """ )
220+ }
221+ )
222+ ),
223+ @ ApiResponse (
224+ responseCode = "403" ,
225+ description = "권한 없음 (작성자 아님)" ,
226+ content = @ Content (
227+ mediaType = "application/json" ,
228+ examples = @ ExampleObject (value = """
229+ {
230+ "success": false,
231+ "code": "COMMENT_002",
232+ "message": "댓글 작성자만 수정/삭제할 수 있습니다.",
233+ "data": null
234+ }
235+ """ )
236+ )
237+ ),
238+ @ ApiResponse (
239+ responseCode = "404" ,
240+ description = "존재하지 않는 게시글 또는 댓글" ,
241+ content = @ Content (
242+ mediaType = "application/json" ,
243+ examples = {
244+ @ ExampleObject (name = "존재하지 않는 게시글" , value = """
245+ {
246+ "success": false,
247+ "code": "POST_001",
248+ "message": "존재하지 않는 게시글입니다.",
249+ "data": null
250+ }
251+ """ ),
252+ @ ExampleObject (name = "존재하지 않는 댓글" , value = """
253+ {
254+ "success": false,
255+ "code": "COMMENT_001",
256+ "message": "존재하지 않는 댓글입니다.",
257+ "data": null
258+ }
259+ """ )
260+ }
261+ )
262+ ),
263+ @ ApiResponse (
264+ responseCode = "500" ,
265+ description = "서버 내부 오류" ,
266+ content = @ Content (
267+ mediaType = "application/json" ,
268+ examples = @ ExampleObject (value = """
269+ {
270+ "success": false,
271+ "code": "COMMON_500",
272+ "message": "서버 오류가 발생했습니다.",
273+ "data": null
274+ }
275+ """ )
276+ )
277+ )
278+ })
279+ ResponseEntity <RsData <CommentResponse >> updateComment (
280+ @ PathVariable Long postId ,
281+ @ PathVariable Long commentId ,
282+ @ RequestBody CommentRequest request ,
283+ @ AuthenticationPrincipal CustomUserDetails user
284+ );
285+
286+ @ Operation (
287+ summary = "댓글 삭제" ,
288+ description = "로그인한 사용자가 자신이 작성한 댓글을 삭제합니다."
289+ )
290+ @ ApiResponses ({
291+ @ ApiResponse (
292+ responseCode = "200" ,
293+ description = "댓글 삭제 성공" ,
294+ content = @ Content (
295+ mediaType = "application/json" ,
296+ examples = @ ExampleObject (value = """
297+ {
298+ "success": true,
299+ "code": "SUCCESS_200",
300+ "message": "댓글이 삭제되었습니다.",
301+ "data": null
302+ }
303+ """ )
304+ )
305+ ),
306+ @ ApiResponse (
307+ responseCode = "401" ,
308+ description = "인증 실패 (토큰 없음/잘못됨/만료)" ,
309+ content = @ Content (
310+ mediaType = "application/json" ,
311+ examples = {
312+ @ ExampleObject (name = "토큰 없음" , value = """
313+ {
314+ "success": false,
315+ "code": "AUTH_001",
316+ "message": "인증이 필요합니다.",
317+ "data": null
318+ }
319+ """ ),
320+ @ ExampleObject (name = "잘못된 토큰" , value = """
321+ {
322+ "success": false,
323+ "code": "AUTH_002",
324+ "message": "유효하지 않은 액세스 토큰입니다.",
325+ "data": null
326+ }
327+ """ ),
328+ @ ExampleObject (name = "만료된 토큰" , value = """
329+ {
330+ "success": false,
331+ "code": "AUTH_004",
332+ "message": "만료된 액세스 토큰입니다.",
333+ "data": null
334+ }
335+ """ )
336+ }
337+ )
338+ ),
339+ @ ApiResponse (
340+ responseCode = "403" ,
341+ description = "권한 없음 (작성자 아님)" ,
342+ content = @ Content (
343+ mediaType = "application/json" ,
344+ examples = @ ExampleObject (value = """
345+ {
346+ "success": false,
347+ "code": "COMMENT_002",
348+ "message": "댓글 작성자만 수정/삭제할 수 있습니다.",
349+ "data": null
350+ }
351+ """ )
352+ )
353+ ),
354+ @ ApiResponse (
355+ responseCode = "404" ,
356+ description = "존재하지 않는 게시글 또는 댓글" ,
357+ content = @ Content (
358+ mediaType = "application/json" ,
359+ examples = {
360+ @ ExampleObject (name = "존재하지 않는 게시글" , value = """
361+ {
362+ "success": false,
363+ "code": "POST_001",
364+ "message": "존재하지 않는 게시글입니다.",
365+ "data": null
366+ }
367+ """ ),
368+ @ ExampleObject (name = "존재하지 않는 댓글" , value = """
369+ {
370+ "success": false,
371+ "code": "COMMENT_001",
372+ "message": "존재하지 않는 댓글입니다.",
373+ "data": null
374+ }
375+ """ )
376+ }
377+ )
378+ ),
379+ @ ApiResponse (
380+ responseCode = "500" ,
381+ description = "서버 내부 오류" ,
382+ content = @ Content (
383+ mediaType = "application/json" ,
384+ examples = @ ExampleObject (value = """
385+ {
386+ "success": false,
387+ "code": "COMMON_500",
388+ "message": "서버 오류가 발생했습니다.",
389+ "data": null
390+ }
391+ """ )
392+ )
393+ )
394+ })
395+ ResponseEntity <RsData <Void >> deleteComment (
396+ @ PathVariable Long postId ,
397+ @ PathVariable Long commentId ,
398+ @ AuthenticationPrincipal CustomUserDetails user
399+ );
144400}
0 commit comments