관리자 백링크 모달 검색 개선

This commit is contained in:
2026-07-10 17:08:14 +09:00
parent 04c03ad604
commit cf7d6ca0de
7 changed files with 83 additions and 23 deletions

View File

@@ -916,7 +916,7 @@ export const listMediaReferencePosts = async () => {
/**
* 게시물을 링크하고 있는 관리자 게시물 목록을 조회한다.
* @param {string} id - 참조 대상 게시물 ID
* @returns {Promise<{ target: { id: string, title: string, slug: string }, posts: Array<{ id: string, title: string, slug: string, status: string, publishedAt: string | null, updatedAt: string, referenceCount: number }> } | null>} 참조 게시물 목록
* @returns {Promise<{ target: { id: string, title: string, slug: string }, posts: Array<{ id: string, title: string, slug: string, status: string, publishedAt: string | null, updatedAt: string }> } | null>} 참조 게시물 목록
*/
export const listAdminPostReferences = async (id) => {
const sql = getPostgresClient()
@@ -940,11 +940,14 @@ export const listAdminPostReferences = async (id) => {
referenceCount: countPostLinkReferences(post.content, target.slug)
})
const removeReferenceCount = ({ referenceCount, ...post }) => post
if (!sql) {
const posts = getSamplePosts()
.filter((post) => post.id !== target.id)
.map(mapReferenceRow)
.filter((post) => post.referenceCount > 0)
.map(removeReferenceCount)
return {
target: {
@@ -980,6 +983,7 @@ export const listAdminPostReferences = async (id) => {
posts: rows
.map(mapReferenceRow)
.filter((post) => post.referenceCount > 0)
.map(removeReferenceCount)
}
}