@@ -30,7 +30,7 @@ export const toCreateReportResponse = ({
3030
3131
3232
33- // 신고된 프롬프트 목록 조회 응답 인터페이스
33+ // 개별 신고 항목 DTO
3434export interface ReportedPromptDTO {
3535 report_id : number ;
3636 prompt_id : number ;
@@ -40,33 +40,42 @@ export interface ReportedPromptDTO {
4040 created_at : string ;
4141 is_read : boolean ;
4242}
43- // 전체 신고 목록 응답 타입
43+
44+
45+ // 전체 응답 DTO
4446export interface ReportedPromptListResponse {
4547 reports : ReportedPromptDTO [ ] ; // 신고 목록 배열
4648 has_more : boolean ; // 다음 페이지 여부
49+ total_count : number ; // 전체 신고 수
4750}
48- // 변환 함수(신고목록->api응답)
51+
52+
53+ // 변환 함수
4954export const toReportedPromptListResponse = (
5055 reports : ( PromptReport & {
5156 prompt : { prompt_id : number ; title : string } ; // 프롬프트 정보 (프롬프트 ID & 제목)
5257 reporter : { user_id : number ; nickname : string } ; // 신고자 정보 (ID & 닉네임)
5358 } ) [ ] ,
54- hasMore : boolean
59+ hasMore : boolean ,
60+ totalCount : number
5561) : ReportedPromptListResponse => {
56- // DB 원본 데이터를 ReportedPromptDTO 배열로 변환
62+
63+ // 개별 신고 항목 변환
5764 const transformed : ReportedPromptDTO [ ] = reports . map ( ( report ) => ( {
5865 report_id : report . report_id ,
5966 prompt_id : report . prompt . prompt_id ,
6067 prompt_title : report . prompt . title ,
6168 reporter_id : report . reporter . user_id ,
6269 reporter_nickname : report . reporter . nickname ,
6370 created_at : report . created_at . toISOString ( ) ,
64- is_read : report . is_read
71+ is_read : report . is_read ,
6572 } ) ) ;
73+
6674 // 최종 응답 객체 반환 (has_more은 페이징 기준으로 판단)
6775 return {
6876 reports : transformed ,
69- has_more : hasMore
77+ has_more : hasMore ,
78+ total_count : totalCount
7079 } ;
7180} ;
7281
0 commit comments