Skip to content

Commit

Permalink
feat: add search in FaqService [#327]
Browse files Browse the repository at this point in the history
  • Loading branch information
kho903 committed Feb 13, 2022
1 parent e202109 commit 9f72044
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.bancow.bancowback.domain.common.exception.ErrorCode.*;

import java.util.ArrayList;
import java.util.List;

import org.springframework.data.domain.Page;
Expand All @@ -12,6 +13,7 @@
import com.bancow.bancowback.domain.common.dto.ServiceResult;
import com.bancow.bancowback.domain.common.exception.FaqException;
import com.bancow.bancowback.domain.common.util.token.service.TokenService;
import com.bancow.bancowback.domain.main.faq.dto.FaqSearchResultDto;
import com.bancow.bancowback.domain.main.faq.entity.Faq;
import com.bancow.bancowback.domain.main.faq.mapper.FaqMapper;
import com.bancow.bancowback.domain.main.faq.dto.FaqAddDto;
Expand Down Expand Up @@ -92,4 +94,9 @@ public ServiceResult updateFaq(String token, FaqUpdateDto faqUpdateDto) {
faqRepository.save(faq);
return ServiceResult.success("FAQ 수정 성공!");
}

public List<FaqSearchResultDto> search(String word) {
List<Faq> result = faqRepository.findByTitleContaining(word);
return faqMapper.toSearchResultDto(result);
}
}

0 comments on commit 9f72044

Please sign in to comment.