Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add isReation field to get memeInfo api #44

Merged
merged 1 commit into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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