From 3f8bf9eaa5cb19b7645746c657f65cc595ec9dfc Mon Sep 17 00:00:00 2001 From: yubinquitous <65652094+yubinquitous@users.noreply.github.com> Date: Tue, 28 May 2024 14:10:38 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20community=20=EA=B2=8C=EC=8B=9C=EB=AC=BC?= =?UTF-8?q?=20=EC=A1=B0=ED=9A=8C=20api=EC=97=90=EC=84=9C=20image=20url=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20(#354)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [FIX] community 게시글 조회 api의 contentDescription nullable로 명세 변경 * [FIX] thumbnailUrl이 null일 경우 dummy로 대체 --- functions/api/routes/community/communityPostGET.js | 1 + functions/api/routes/community/communityPostsGET.js | 4 +++- functions/constants/swagger/schemas/communitySchema.js | 8 ++++---- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/functions/api/routes/community/communityPostGET.js b/functions/api/routes/community/communityPostGET.js index ef26b3b..f2d6e2d 100644 --- a/functions/api/routes/community/communityPostGET.js +++ b/functions/api/routes/community/communityPostGET.js @@ -43,6 +43,7 @@ module.exports = asyncWrapper(async (req, res) => { } communityPost.createdAt = dayjs(`${communityPost.createdAt}`).format('YYYY. MM. DD'); + communityPost.thumbnailUrl = communityPost.thumbnailUrl || dummyImages.content_dummy; res.status(statusCode.OK).send( util.success(statusCode.OK, responseMessage.READ_COMMUNITY_POST_SUCCESS, { diff --git a/functions/api/routes/community/communityPostsGET.js b/functions/api/routes/community/communityPostsGET.js index e1d423d..701f985 100644 --- a/functions/api/routes/community/communityPostsGET.js +++ b/functions/api/routes/community/communityPostsGET.js @@ -37,11 +37,13 @@ module.exports = asyncWrapper(async (req, res) => { const offset = (page - 1) * limit; const communityPosts = await communityDB.getCommunityPosts(dbConnection, userId, limit, offset); - // 각 게시글의 createdAt 형식 변경 및 프로필 이미지 추가 + + // 각 게시글의 createdAt 형식 변경, 프로필 이미지 추가, 썸네일 이미지 null일 경우 대체 이미지 추가 const result = await Promise.all( communityPosts.map((communityPost) => { communityPost.createdAt = dayjs(`${communityPost.createdAt}`).format('YYYY. MM. DD'); communityPost.profileImage = dummyImages.user_profile_dummy; + communityPost.thumbnailUrl = communityPost.thumbnailUrl || dummyImages.content_dummy; return communityPost; }), ); diff --git a/functions/constants/swagger/schemas/communitySchema.js b/functions/constants/swagger/schemas/communitySchema.js index e4e7784..70ba77f 100644 --- a/functions/constants/swagger/schemas/communitySchema.js +++ b/functions/constants/swagger/schemas/communitySchema.js @@ -22,7 +22,7 @@ const responseCommunityPostsDetailSchema = { $body: '본문', $contentUrl: 'https://naver.com', $contentTitle: '콘텐츠 링크 제목', - $contentDescription: '콘텐츠 링크 설명', + contentDescription: '콘텐츠 링크 설명', $thumbnailUrl: 'https://content-thumbnail-image-url', $createdAt: '2024. 02. 01', }, @@ -42,7 +42,7 @@ const responseCommunityPostsSchema = { $body: '본문1', $contentUrl: 'https://naver.com', $contentTitle: '콘텐츠 링크 제목1', - $contentDescription: '콘텐츠 링크 설명1', + contentDescription: '콘텐츠 링크 설명1', $thumbnailUrl: 'https://content-thumbnail-image-url1', $createdAt: '2024. 02. 01', }, @@ -54,7 +54,7 @@ const responseCommunityPostsSchema = { $body: '본문2', $contentUrl: 'https://example2.com', $contentTitle: '콘텐츠 링크 제목2', - $contentDescription: '콘텐츠 링크 설명2', + contentDescription: '콘텐츠 링크 설명2', $thumbnailUrl: 'https://content-thumbnail-image-url2', $createdAt: '2024. 02. 02', }, @@ -66,7 +66,7 @@ const responseCommunityPostsSchema = { $body: '본문3', $contentUrl: 'https://example3.com', $contentTitle: '콘텐츠 링크 제목3', - $contentDescription: '콘텐츠 링크 설명3', + contentDescription: '콘텐츠 링크 설명3', $thumbnailUrl: 'https://content-thumbnail-image-url3', $createdAt: '2024. 02. 03', },