diff --git a/apps/backend/src/routes/post.ts b/apps/backend/src/routes/post.ts index 513918c..81a3a4f 100644 --- a/apps/backend/src/routes/post.ts +++ b/apps/backend/src/routes/post.ts @@ -235,12 +235,24 @@ export default new Elysia({ prefix: "/post" }) return status(404, "포스트를 찾을 수 없습니다."); } + const tweetData = typeof post.tweet === "object" && post.tweet !== null + ? post.tweet as { + text?: string; + title?: string; + description?: string; + } + : undefined; + return { _id: post._id, type: post.type, url: post.tweet?.url, author: post.author, tags: Array.isArray(post.tags) ? post.tags : [], + tweet: tweetData ? { + text: tweetData.text ?? tweetData.description, + title: tweetData.title, + } : undefined, mediaUrl: post.mediaUrl, mediaIndex: post.mediaIndex, }; diff --git a/apps/frontend/src/app/detail/[id]/page.tsx b/apps/frontend/src/app/detail/[id]/page.tsx index 41216df..5c4f550 100644 --- a/apps/frontend/src/app/detail/[id]/page.tsx +++ b/apps/frontend/src/app/detail/[id]/page.tsx @@ -40,7 +40,7 @@ function createDetailDescription(post: PostDetailResponse) { function createDetailTitle(post: PostDetailResponse) { const author = post.author?.trim() || "unknown"; const source = getSourceLabel(post.type); - const rawText = post.type === "twitter" ? post.tweet?.text : post.tweet?.title; + const rawText = post.tweet?.text || post.tweet?.title; const contentText = rawText?.trim() || post._id; return `${author} - ${contentText} | ${source}`; }