대표 이미지 전용 카드 썸네일로 정리
This commit is contained in:
@@ -21,7 +21,10 @@ import {
|
||||
parseSignupBlockedUsernamesFromDb
|
||||
} from '../../lib/signup-blocked-usernames.js'
|
||||
import { normalizeSocialLinks } from '../../lib/social-links.js'
|
||||
import { getExistingPostThumbnailUrl } from '../utils/post-thumbnail-image.js'
|
||||
import {
|
||||
createPostThumbnailForImageUrl,
|
||||
getExistingPostThumbnailUrl
|
||||
} from '../utils/post-thumbnail-image.js'
|
||||
import { getPostgresClient } from './postgres-client'
|
||||
|
||||
/**
|
||||
@@ -38,6 +41,7 @@ const mapPostRow = (row) => ({
|
||||
excerpt: row.excerpt,
|
||||
featuredImage: row.featured_image,
|
||||
featuredImageThumbnail: getExistingPostThumbnailUrl(row.featured_image),
|
||||
showFeaturedImage: Boolean(row.show_featured_image),
|
||||
isFeatured: Boolean(row.is_featured),
|
||||
commentCount: Number(row.comment_count || 0),
|
||||
seoTitle: row.seo_title || '',
|
||||
@@ -361,6 +365,7 @@ export const createAdminPost = async (input, authorId) => {
|
||||
content,
|
||||
excerpt,
|
||||
featured_image,
|
||||
show_featured_image,
|
||||
is_featured,
|
||||
seo_title,
|
||||
seo_description,
|
||||
@@ -377,6 +382,7 @@ export const createAdminPost = async (input, authorId) => {
|
||||
${input.content},
|
||||
${input.excerpt},
|
||||
${input.featuredImage},
|
||||
${input.showFeaturedImage},
|
||||
${input.isFeatured},
|
||||
${input.seoTitle},
|
||||
${input.seoDescription},
|
||||
@@ -394,6 +400,8 @@ export const createAdminPost = async (input, authorId) => {
|
||||
return insertedRows
|
||||
})
|
||||
|
||||
await createPostThumbnailForImageUrl(input.featuredImage)
|
||||
|
||||
return getAdminPostById(rows[0].id)
|
||||
}
|
||||
|
||||
@@ -421,6 +429,7 @@ export const updateAdminPost = async (id, input, editorId) => {
|
||||
content = ${input.content},
|
||||
excerpt = ${input.excerpt},
|
||||
featured_image = ${input.featuredImage},
|
||||
show_featured_image = ${input.showFeaturedImage},
|
||||
is_featured = ${input.isFeatured},
|
||||
seo_title = ${input.seoTitle},
|
||||
seo_description = ${input.seoDescription},
|
||||
@@ -443,6 +452,10 @@ export const updateAdminPost = async (id, input, editorId) => {
|
||||
return updatedRows
|
||||
})
|
||||
|
||||
if (rows[0]) {
|
||||
await createPostThumbnailForImageUrl(input.featuredImage)
|
||||
}
|
||||
|
||||
return rows[0] ? getAdminPostById(rows[0].id) : null
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user