Skip to content

Commit

Permalink
[FIX] community 게시물 조회 api에서 image url 수정 (#354)
Browse files Browse the repository at this point in the history
* [FIX] community 게시글 조회 api의 contentDescription nullable로 명세 변경

* [FIX] thumbnailUrl이 null일 경우 dummy로 대체
  • Loading branch information
yubinquitous authored May 28, 2024
1 parent 2fd50c5 commit 3f8bf9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions functions/api/routes/community/communityPostGET.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
4 changes: 3 additions & 1 deletion functions/api/routes/community/communityPostsGET.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}),
);
Expand Down
8 changes: 4 additions & 4 deletions functions/constants/swagger/schemas/communitySchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const responseCommunityPostsDetailSchema = {
$body: '본문',
$contentUrl: 'https://naver.com',
$contentTitle: '콘텐츠 링크 제목',
$contentDescription: '콘텐츠 링크 설명',
contentDescription: '콘텐츠 링크 설명',
$thumbnailUrl: 'https://content-thumbnail-image-url',
$createdAt: '2024. 02. 01',
},
Expand All @@ -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',
},
Expand All @@ -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',
},
Expand All @@ -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',
},
Expand Down

0 comments on commit 3f8bf9e

Please sign in to comment.