Skip to content

Commit

Permalink
Merge pull request #29 from sen2y/features/zustand
Browse files Browse the repository at this point in the history
🐛 keyword > searchTerm 용어로 통일
  • Loading branch information
sen2y authored Jul 6, 2024
2 parents 049a401 + 51a06e8 commit df31d33
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions src/routes/word/word.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ exports.getRankWords = async (req, res) => {
// 연관검색어 : 쿼리스트링으로 전달받은 검색어 searchTerm을 포함하는 단어 조회
exports.getRelatedWords = async (req, res) => {
try {
let { keyword, limit } = req.query;
keyword = validateRequest(relatedTermSchema, keyword);
console.log(keyword, limit);
const data = await wordService.getRelatedWords(keyword, limit);
let { searchTerm, limit } = req.query;
searchTerm = validateRequest(relatedTermSchema, searchTerm);
console.log(searchTerm, limit);
const data = await wordService.getRelatedWords(searchTerm, limit);
sendResponse.ok(res, {
message: SucesssMessage.RELATED_WORDS_SUCCESS,
data,
Expand Down
4 changes: 2 additions & 2 deletions src/routes/word/word.repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ exports.getRankWords = async () => {
}
};

exports.getRelatedWords = async (keyword, limit) => {
exports.getRelatedWords = async (searchTerm, limit) => {
try {
const relatedWords = await Word.find({ word: new RegExp(keyword, 'i') })
const relatedWords = await Word.find({ word: new RegExp(searchTerm, 'i') })
.sort({ freq: -1 })
.limit(parseInt(limit));
const wordNames = relatedWords.map((word) => word.word);
Expand Down
2 changes: 1 addition & 1 deletion src/routes/word/word.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const { getRankWords, getSearchWords, getRelatedWords } = require('./word.contro
// 인기 검색어 조회
wordRouter.get('/rank', getRankWords);
// 연관검색어 : 쿼리스트링으로 전달받은 검색어 searchTerm을 포함하는 단어 조회
wordRouter.get('/keyword', getRelatedWords);
wordRouter.get('/searchTerm', getRelatedWords);
// 검색어 조회
wordRouter.post('/search/:searchTerm', isUser, getSearchWords);

Expand Down
4 changes: 2 additions & 2 deletions src/routes/word/word.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports.getRankWords = async () => {
};

// 연관검색어 조회
exports.getRelatedWords = async (keyword, limit) => {
const relatedWords = await wordRepository.getRelatedWords(keyword, limit);
exports.getRelatedWords = async (searchTerm, limit) => {
const relatedWords = await wordRepository.getRelatedWords(searchTerm, limit);
return relatedWords;
};

0 comments on commit df31d33

Please sign in to comment.