-
Notifications
You must be signed in to change notification settings - Fork 1
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
검색 기능 구현 #45
검색 기능 구현 #45
Conversation
} from '../controller/meme.controller'; | ||
import { | ||
getRequestedMemeInfo, | ||
getKeywordInfoByName, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 미들웨어 왜 controller 부분으로 이동한거야 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 정확히는
기존 검색 API에서는 키워드를 선택해서 검색 결과를 받아오는 (반쪽짜리 검색) 방식이어서, 미들웨어 단에서 해당 키워드가 있는지 검증해줬었는데,
피처를 추가하게 되면서 검색 API에서 검색어로 검색 결과를 받아오는 방식이 추가되었어
컨트롤러 단에서 키워드 방식인 경우에만 해당 검증을 하도록 변경한거야!
src/model/meme.ts
Outdated
@@ -59,7 +59,7 @@ const MemeSchema: Schema = new Schema( | |||
keywordIds: { type: [Types.ObjectId], ref: 'Keyword', required: true, default: [] }, | |||
image: { type: String, required: true }, | |||
reaction: { type: Number, required: true, default: 0 }, | |||
source: { type: String, required: true }, | |||
source: { type: String, default: '' }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
피그마에서는 필수로 표시되어있던 거 같은데 상관없나 ???
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
앗 이게 백오피스때문에 필수 빼뒀던 것 같은데.. 다시 required 옵션 추가했어요~
@@ -177,6 +177,24 @@ async function getRecommendedKeywords(): Promise< | |||
} | |||
} | |||
|
|||
async function getSearchedKeywords(term: string): Promise<Types.ObjectId[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기로 이동했구낭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 함수는 getKeywordInfoByName
이 함수랑 동작이 조금 달라!
이건 regex 써서 해당 글자가 포함되어 있는지 검색하고 getKeywordInfoByName
는 완벽히 일치하는 도큐먼트만 반환해
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인은 옛날에 했는데 approve를 안했네 쏘링,,,
/api/meme/search?q={term}
/api/meme/search/{name}