Skip to content

Commit

Permalink
Merge pull request #44 from mash-up-kr/develop
Browse files Browse the repository at this point in the history
feat: add isReation field to get memeInfo api
  • Loading branch information
pjw5521 authored Aug 11, 2024
2 parents d409585 + 37b24a8 commit 51e881b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/model/meme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface IMemeGetResponse {
isDeleted: boolean;
keywords: IKeywordGetResponse[];
isSaved: boolean; // 나의 파밈함 저장 여부
isReaction: boolean; // reaction 여부
}

export interface IMemeDocument extends Document {
Expand Down
8 changes: 8 additions & 0 deletions src/service/meme.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,18 @@ async function getMemeWithKeywords(
true, // {isDeleted: false} 조건으로 save 상태인지 확인
);

const isReaction = await MemeInteractionService.getMemeInteractionInfo(
user,
meme,
InteractionType.REACTION,
true,
);

return {
..._.omit(meme, 'keywordIds'),
keywords,
isSaved: !_.isNil(isSaved),
isReaction: !_.isNil(isReaction),
};
} catch (err) {
logger.error(`Failed to get a meme(${meme._id}) with keywords: ${err.message}`);
Expand Down

0 comments on commit 51e881b

Please sign in to comment.