글쓰기 태그 제한과 표 기능 추가

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-09 17:10:16 +09:00
parent ed30926250
commit 95d234a625
24 changed files with 560 additions and 54 deletions

View File

@@ -1,7 +1,7 @@
import { createError, getRouterParam, readBody } from 'h3'
import { requireAdminSession } from '../../../../utils/admin-auth'
import { parseAdminPostInput } from '../../../../utils/admin-post-input'
import { updateAdminPost } from '../../../../repositories/content-repository'
import { getSiteSettings, updateAdminPost } from '../../../../repositories/content-repository'
/**
* 관리자 게시물 수정 API
@@ -21,6 +21,16 @@ export default defineEventHandler(async (event) => {
})
}
const settings = await getSiteSettings()
const postTagLimit = Number(settings.postTagLimit || 5)
if (parsedBody.data.tags.length > postTagLimit) {
throw createError({
statusCode: 400,
message: `태그는 최대 ${postTagLimit}개까지 선택할 수 있습니다.`
})
}
try {
const post = await updateAdminPost(id, parsedBody.data, adminSession.userId)