미디어 본문 이미지 사용처 계산 수정

This commit is contained in:
2026-07-03 15:27:39 +09:00
parent 288e73c0dc
commit 33c92a6f72
10 changed files with 112 additions and 14 deletions

View File

@@ -776,6 +776,46 @@ export const listAdminPosts = async (options = {}) => {
}
}
/**
* 미디어 사용처 계산용 게시물 참조 목록 조회
* @returns {Promise<Array<{ id: string, title: string, slug: string, status: string, featuredImage: string | null, content: string }>>} 게시물 미디어 참조 목록
*/
export const listMediaReferencePosts = async () => {
const sql = getPostgresClient()
if (!sql) {
return getSamplePosts().map((post) => ({
id: post.id,
title: post.title,
slug: post.slug,
status: post.status,
featuredImage: post.featuredImage,
content: post.content || ''
}))
}
const rows = await sql`
SELECT
id,
title,
slug,
status,
featured_image,
content
FROM posts
ORDER BY updated_at DESC
`
return rows.map((row) => ({
id: row.id,
title: toAdminPostFormTitle(row.title),
slug: row.slug,
status: row.status,
featuredImage: row.featured_image,
content: row.content || ''
}))
}
/**
* 관리자 게시물 상세 조회
* @param {string} id - 게시물 ID
@@ -1145,6 +1185,46 @@ export const listPages = async (options = {}) => {
return rows.map(mapPageRow)
}
/**
* 미디어 사용처 계산용 페이지 참조 목록 조회
* @returns {Promise<Array<{ id: string, title: string, slug: string, status: string, featuredImage: string | null, content: string }>>} 페이지 미디어 참조 목록
*/
export const listMediaReferencePages = async () => {
const sql = getPostgresClient()
if (!sql) {
return getSamplePages().map((page) => ({
id: page.id,
title: page.title,
slug: page.slug,
status: page.status,
featuredImage: page.featuredImage,
content: page.content || ''
}))
}
const rows = await sql`
SELECT
id,
title,
slug,
status,
featured_image,
content
FROM pages
ORDER BY updated_at DESC
`
return rows.map((row) => ({
id: row.id,
title: row.title,
slug: row.slug,
status: row.status,
featuredImage: row.featured_image,
content: row.content || ''
}))
}
/**
* 관리자 고정 페이지 목록 조회
* @returns {Promise<Array>} 관리자 고정 페이지 목록