diff --git a/src/app/api/posts/[id]/report/route.ts b/src/app/api/posts/[id]/report/route.ts index d3bcdfd..109fba0 100644 --- a/src/app/api/posts/[id]/report/route.ts +++ b/src/app/api/posts/[id]/report/route.ts @@ -24,6 +24,20 @@ export async function POST(req: Request, context: { params: Promise<{ id: string data: { type: "REPORT", message: `신고 발생: post ${id}`, targetType: "POST", targetId: id }, }); + // 자동 블라인드 임계치: 신고 3회 이상시 hidden 처리 + const stat = await prisma.postStat.upsert({ + where: { postId: id }, + update: { reportCount: { increment: 1 } }, + create: { postId: id, reportCount: 1 }, + }); + const threshold = 3; + if ((stat.reportCount + 1) >= threshold) { + await prisma.post.update({ where: { id }, data: { status: "hidden" } }); + await prisma.adminNotification.create({ + data: { type: "AUTO_HIDE", message: `신고 누적 ${threshold}건으로 블라인드됨: post ${id}`, targetType: "POST", targetId: id }, + }); + } + return NextResponse.json({ ok: true, reportId: report.id }); } diff --git a/todolist.txt b/todolist.txt index 5c29bc4..881ec0e 100644 --- a/todolist.txt +++ b/todolist.txt @@ -46,7 +46,7 @@ 7.4 첨부 업로드 및 본문 삽입 o 7.5 추천/신고, 조회수 카운트 o 7.6 익명/비밀댓글/비댓 해시 처리 o -7.7 신고→알림→블라인드 자동화 훅 +7.7 신고→알림→블라인드 자동화 훅 o 7.8 일반 게시판 공용 폼/라우트 템플릿 생성 7.9 일반 카테고리 설정 매핑(공지/가입인사/버그건의/이벤트/소통방/자유/무엇이든/마사지꿀팁/관리사찾아요/청와대/방문후기[승인]) 7.10 제휴업소 일반(사진) 카테고리 전용 이미지 첨부/미리보기 규칙