@@ -7,10 +7,12 @@ import {
77 videoCommentResponseDTO ,
88 videoCommentListResponseDTO ,
99} from "../dtos/comment.dto.js" ;
10+ import { getShareCommentsResponseDTO } from "../dtos/shareLink.dto.js" ;
1011import {
1112 createSlideComment ,
1213 createVideoComment ,
1314 deleteComment ,
15+ getAllVideoComments ,
1416 getSlideComments ,
1517 getVideoCommentsByTimestamp ,
1618 updateComment ,
@@ -843,6 +845,120 @@ export const getVideoCommentsByTimestampController = async (req, res, next) => {
843845 }
844846} ;
845847
848+ // 영상 전체 댓글 조회
849+ export const getAllVideoCommentsController = async ( req , res , next ) => {
850+ /**
851+ * @swagger
852+ * /videos/{videoId}/comments/all:
853+ * get:
854+ * summary: 영상 전체 댓글 목록 조회
855+ * description: |
856+ * 특정 영상에 달린 댓글/답글 전체를 조회합니다.
857+ * tags: [Comment]
858+ * security:
859+ * - bearerAuth: []
860+ * parameters:
861+ * - in: path
862+ * name: videoId
863+ * required: true
864+ * schema:
865+ * type: string
866+ * example: "456"
867+ * description: 영상 ID
868+ * responses:
869+ * 200:
870+ * description: 영상 전체 댓글 목록 조회 성공
871+ * content:
872+ * application/json:
873+ * schema:
874+ * $ref: "#/components/schemas/VideoAllCommentsResponse"
875+ * example:
876+ * resultType: "SUCCESS"
877+ * error: null
878+ * success:
879+ * comments:
880+ * - commentId: "1"
881+ * content: "이 부분 설명이 아주 좋네요!"
882+ * userId: "12"
883+ * isMine: true
884+ * writer: "가넷"
885+ * targetType: "video"
886+ * targetId: "456"
887+ * parentId: "2"
888+ * timestampMs: 12000
889+ * createdAt: "2026-02-10T15:00:00.000Z"
890+ * 400:
891+ * description: 잘못된 videoId
892+ * content:
893+ * application/json:
894+ * schema:
895+ * $ref: "#/components/schemas/ErrorResponse"
896+ * examples:
897+ * invalidVideoId:
898+ * value:
899+ * resultType: "FAILURE"
900+ * error:
901+ * errorCode: "P001"
902+ * reason: "videoId가 올바르지 않습니다."
903+ * data:
904+ * videoId: "abc"
905+ * success: null
906+ * 401:
907+ * description: 인증 실패 (JWT 누락/만료)
908+ * content:
909+ * application/json:
910+ * schema:
911+ * $ref: "#/components/schemas/ErrorResponse"
912+ * examples:
913+ * unauthorized:
914+ * value:
915+ * resultType: FAILURE
916+ * error:
917+ * errorCode: A004
918+ * reason: 인증 세션 정보가 없거나 유효하지 않습니다.
919+ * data: null
920+ * success: null
921+ * 404:
922+ * description: 영상 없음
923+ * content:
924+ * application/json:
925+ * schema:
926+ * $ref: "#/components/schemas/ErrorResponse"
927+ * examples:
928+ * videoNotFound:
929+ * value:
930+ * resultType: "FAILURE"
931+ * error:
932+ * errorCode: "V001"
933+ * reason: "영상을 찾을 수 없습니다."
934+ * data:
935+ * videoId: "456"
936+ * success: null
937+ * 500:
938+ * description: 서버 내부 오류
939+ * content:
940+ * application/json:
941+ * schema:
942+ * $ref: "#/components/schemas/ErrorResponse"
943+ */
944+ try {
945+ const { videoId } = req . params ;
946+
947+ const comments = await getAllVideoComments ( { videoId } ) ;
948+
949+ res . status ( 200 ) . json ( {
950+ resultType : "SUCCESS" ,
951+ error : null ,
952+ success : getShareCommentsResponseDTO ( {
953+ comments,
954+ currentUserId : req . user ?. id ?? null ,
955+ } ) ,
956+ } ) ;
957+ } catch ( e ) {
958+ next ( e ) ;
959+ }
960+ } ;
961+
846962/**
847963 * @swagger
848964 * components:
@@ -1216,4 +1332,59 @@ export const getVideoCommentsByTimestampController = async (req, res, next) => {
12161332 * type: array
12171333 * items:
12181334 * $ref: "#/components/schemas/VideoCommentListItem"
1335+ *
1336+ * VideoAllCommentItem:
1337+ * type: object
1338+ * properties:
1339+ * commentId:
1340+ * type: string
1341+ * example: "1"
1342+ * content:
1343+ * type: string
1344+ * example: "이 부분 설명이 아주 좋네요!"
1345+ * userId:
1346+ * type: string
1347+ * example: "12"
1348+ * isMine:
1349+ * type: boolean
1350+ * example: true
1351+ * writer:
1352+ * type: string
1353+ * example: "가넷"
1354+ * targetType:
1355+ * type: string
1356+ * enum: [video]
1357+ * example: "video"
1358+ * targetId:
1359+ * type: string
1360+ * example: "456"
1361+ * parentId:
1362+ * type: string
1363+ * nullable: true
1364+ * example: "2"
1365+ * timestampMs:
1366+ * type: integer
1367+ * nullable: true
1368+ * example: 12000
1369+ * createdAt:
1370+ * type: string
1371+ * format: date-time
1372+ * example: "2026-02-10T15:00:00.000Z"
1373+ *
1374+ * VideoAllCommentsResponse:
1375+ * type: object
1376+ * properties:
1377+ * resultType:
1378+ * type: string
1379+ * example: SUCCESS
1380+ * error:
1381+ * nullable: true
1382+ * example: null
1383+ * success:
1384+ * type: object
1385+ * properties:
1386+ * comments:
1387+ * type: array
1388+ * items:
1389+ * $ref: "#/components/schemas/VideoAllCommentItem"
12191390 */
0 commit comments