관리자 백링크 모달 검색 개선
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user