Skip to content

Commit c8bee4e

Browse files
authored
Merge pull request #14 from BCSDLab/hotfix/search_null
handle exception if search query is null && fix typo on grant check
2 parents a569812 + f88e416 commit c8bee4e

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/java/koreatech/in/controller/LostAndFoundController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ ResponseEntity deleteLostItemComment(@ApiParam(required = true) @PathVariable(va
133133
@RequestMapping(value = "/lost/lostItems/grant/check", method = RequestMethod.POST)
134134
public @ResponseBody
135135
ResponseEntity checkGrantEditItem(@ApiParam(required = true) @RequestBody Map<String, Integer> lostItem_id) throws Exception {
136-
if (lostItem_id == null || !lostItem_id.containsKey("article_id"))
136+
if (lostItem_id == null || !lostItem_id.containsKey("lostItem_id"))
137137
throw new PreconditionFailedException(new ErrorMessage("올바르지 않은 데이터입니다.", 0));
138138

139139
return new ResponseEntity<Map<String, Boolean>>(lostAndFoundService.checkGrantEditLostItem(lostItem_id.get("lostItem_id")), HttpStatus.OK);

src/main/java/koreatech/in/controller/MarketPlaceController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ ResponseEntity deleteItemComment(@ApiParam(required = true) @PathVariable(value
130130
@RequestMapping(value = "/market/items/grant/check", method = RequestMethod.POST)
131131
public @ResponseBody
132132
ResponseEntity checkGrantEditItem(@ApiParam(required = true) @RequestBody Map<String, Integer> item_id) throws Exception {
133-
if (item_id == null || !item_id.containsKey("article_id"))
133+
if (item_id == null || !item_id.containsKey("item_id"))
134134
throw new PreconditionFailedException(new ErrorMessage("올바르지 않은 데이터입니다.", 0));
135135

136136
return new ResponseEntity<Map<String, Boolean>>(marketPlaceService.checkGrantEditItem(item_id.get("item_id")), HttpStatus.OK);

src/main/java/koreatech/in/service/SearchServiceImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import koreatech.in.util.BeanUtil;
1414
import org.springframework.beans.factory.annotation.Autowired;
1515
import org.springframework.stereotype.Service;
16+
import org.springframework.util.StringUtils;
1617

1718
import java.util.ArrayList;
1819
import java.util.HashMap;
@@ -27,7 +28,7 @@ public class SearchServiceImpl implements SearchService {
2728
private SearchMapper searchMapper;
2829

2930
public Map<String, Object> searchShop(SearchCriteria searchCriteria) throws Exception {
30-
if (searchCriteria.getQuery().isEmpty())
31+
if (!StringUtils.hasText(searchCriteria.getQuery()))
3132
throw new PreconditionFailedException(new ErrorMessage("공백으로는 검색할 수 없습니다.", 0));
3233

3334
Map<String, Object> map = new HashMap<>();
@@ -81,7 +82,7 @@ public Map<String, Object> searchShop(SearchCriteria searchCriteria) throws Exce
8182
}
8283

8384
public Map<String, Object> searchCommunity(SearchCriteria searchCriteria) throws Exception {
84-
if (searchCriteria.getQuery().isEmpty())
85+
if (!StringUtils.hasText(searchCriteria.getQuery()))
8586
throw new PreconditionFailedException(new ErrorMessage("공백으로는 검색할 수 없습니다.", 0));
8687

8788
Map<String, Object> map = new HashMap<>();

0 commit comments

Comments
 (0)