Skip to content

Commit

Permalink
feat : Remove implicit web annotation names
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Nov 16, 2023
1 parent b3a0b8b commit c6cd3ce
Show file tree
Hide file tree
Showing 27 changed files with 187 additions and 396 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,13 @@ public class CustomerController {

@GetMapping
public PagedResult<Customer> getAllCustomers(
@RequestParam(
value = "pageNo",
defaultValue = AppConstants.DEFAULT_PAGE_NUMBER,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_PAGE_NUMBER, required = false)
int pageNo,
@RequestParam(
value = "pageSize",
defaultValue = AppConstants.DEFAULT_PAGE_SIZE,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_PAGE_SIZE, required = false)
int pageSize,
@RequestParam(
value = "sortBy",
defaultValue = AppConstants.DEFAULT_SORT_BY,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_SORT_BY, required = false)
String sortBy,
@RequestParam(
value = "sortDir",
defaultValue = AppConstants.DEFAULT_SORT_DIRECTION,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_SORT_DIRECTION, required = false)
String sortDir) {
return customerService.findAllCustomers(pageNo, pageSize, sortBy, sortDir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ public class ClientController {

@GetMapping
public ResponseEntity<PagedResult<ClientResponse>> getAllClients(
@RequestParam(value = "pageNo", defaultValue = AppConstants.DEFAULT_PAGE_NUMBER, required = false)
int pageNo,
@RequestParam(value = "pageSize", defaultValue = AppConstants.DEFAULT_PAGE_SIZE, required = false)
int pageSize,
@RequestParam(value = "sortBy", defaultValue = AppConstants.DEFAULT_SORT_BY, required = false)
String sortBy,
@RequestParam(value = "sortDir", defaultValue = AppConstants.DEFAULT_SORT_DIRECTION, required = false)
String sortDir) {
@RequestParam(defaultValue = AppConstants.DEFAULT_PAGE_NUMBER, required = false) int pageNo,
@RequestParam(defaultValue = AppConstants.DEFAULT_PAGE_SIZE, required = false) int pageSize,
@RequestParam(defaultValue = AppConstants.DEFAULT_SORT_BY, required = false) String sortBy,
@RequestParam(defaultValue = AppConstants.DEFAULT_SORT_DIRECTION, required = false) String sortDir) {
FindClientsQuery findClientsQuery = new FindClientsQuery(pageNo, pageSize, sortBy, sortDir);
return ResponseEntity.ok(clientService.findAllClients(findClientsQuery));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,13 @@ public class CustomerController {

@GetMapping
public CustomerResponse getAllCustomers(
@RequestParam(
value = "pageNo",
defaultValue = AppConstants.DEFAULT_PAGE_NUMBER,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_PAGE_NUMBER, required = false)
int pageNo,
@RequestParam(
value = "pageSize",
defaultValue = AppConstants.DEFAULT_PAGE_SIZE,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_PAGE_SIZE, required = false)
int pageSize,
@RequestParam(
value = "sortBy",
defaultValue = AppConstants.DEFAULT_SORT_BY,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_SORT_BY, required = false)
String sortBy,
@RequestParam(
value = "sortDir",
defaultValue = AppConstants.DEFAULT_SORT_DIRECTION,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_SORT_DIRECTION, required = false)
String sortDir) {
return customerService.findAllCustomers(pageNo, pageSize, sortBy, sortDir);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,22 @@ public class RestaurantController {

@GetMapping
public Mono<ResponseEntity<SearchPage<Restaurant>>> findAllRestaurants(
@Valid @RequestParam(value = "limit", defaultValue = "10") @Size(max = 999)
Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@Valid @RequestParam(defaultValue = "10") @Size(max = 999) Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return restaurantService.findAllRestaurants(offset, limit).map(ResponseEntity::ok);
}

@GetMapping("/name/{restaurantName}")
public Mono<ResponseEntity<Restaurant>> findRestaurantByName(
@PathVariable("restaurantName") String restaurantName) {
@PathVariable String restaurantName) {
return restaurantService
.findByRestaurantName(restaurantName)
.map(ResponseEntity::ok)
.defaultIfEmpty(ResponseEntity.notFound().build());
}

@GetMapping("/{restaurantId}")
public Mono<ResponseEntity<Restaurant>> findRestaurantById(
@PathVariable("restaurantId") Long restaurantId) {
public Mono<ResponseEntity<Restaurant>> findRestaurantById(@PathVariable Long restaurantId) {
return restaurantService
.findByRestaurantId(restaurantId)
.map(ResponseEntity::ok)
Expand All @@ -72,7 +70,7 @@ public Mono<ResponseEntity<Long>> totalCount() {

@PutMapping("/{restaurantId}/grades/")
public Mono<ResponseEntity<Restaurant>> addNotesToRestaurant(
@PathVariable("restaurantId") Long restaurantId, @RequestBody Grades grades) {
@PathVariable Long restaurantId, @RequestBody Grades grades) {
return restaurantService.addGrade(grades, restaurantId).map(ResponseEntity::ok);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ public class SearchController {

@GetMapping("/search/borough")
public Mono<ResponseEntity<Flux<Restaurant>>> searchPhrase(
@RequestParam("query") String query,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam String query,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService.searchMatchBorough(query, offset, limit).map(ResponseEntity::ok);
}

@GetMapping("/search/multi")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchMulti(
@RequestParam("query") String query,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset,
@RequestParam String query,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset,
@RequestParam(value = "prefix_phrase_enabled", defaultValue = "false")
Boolean prefixPhraseEnabled) {
return searchService
Expand All @@ -44,102 +44,100 @@ public Mono<ResponseEntity<SearchPage<Restaurant>>> searchMulti(

@GetMapping("/search/term/borough")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchTermForBorough(
@RequestParam("query") String query,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam String query,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService.termQueryForBorough(query, offset, limit).map(ResponseEntity::ok);
}

@GetMapping("/search/terms")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchTerms(
@RequestParam("query") List<String> queries,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService.termsQueryForBorough(queries, offset, limit).map(ResponseEntity::ok);
}

@GetMapping("/search/must/bool")
public Mono<ResponseEntity<Flux<Restaurant>>> searchBoolMust(
@RequestParam("borough") String borough,
@RequestParam("cuisine") String cuisine,
@RequestParam("name") String name,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam String borough,
@RequestParam String cuisine,
@RequestParam String name,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService
.queryBoolWithMust(borough, cuisine, name, offset, limit)
.map(ResponseEntity::ok);
}

@GetMapping("/search/should/bool")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchBoolShould(
@RequestParam("borough") String borough,
@RequestParam("cuisine") String cuisine,
@RequestParam("name") String name,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam String borough,
@RequestParam String cuisine,
@RequestParam String name,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService
.queryBoolWithShould(borough, cuisine, name, offset, limit)
.map(ResponseEntity::ok);
}

@GetMapping("/search/wildcard/borough")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchBoolShould(
@RequestParam("query") String query,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam String query,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService.wildcardSearch(query, offset, limit).map(ResponseEntity::ok);
}

@GetMapping("/search/regexp/borough")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchRegularExpression(
@RequestParam("query") String query,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam String query,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService.regExpSearch(query, offset, limit).map(ResponseEntity::ok);
}

@GetMapping("/search/simple")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchSimpleQueryForBoroughAndCuisine(
@RequestParam("query") String query,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam String query,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService
.searchSimpleQueryForBoroughAndCuisine(query, offset, limit)
.map(ResponseEntity::ok);
}

@GetMapping("/search/restaurant/range")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchRestaurantIdRange(
@RequestParam("lowerLimit") Long lowerLimit,
@RequestParam("upperLimit") Long upperLimit,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam Long lowerLimit,
@RequestParam Long upperLimit,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService
.searchRestaurantIdRange(lowerLimit, upperLimit, offset, limit)
.map(ResponseEntity::ok);
}

@GetMapping("/search/date/range")
public Mono<ResponseEntity<SearchPage<Restaurant>>> searchDateRange(
@RequestParam("fromDate") String fromDate,
@RequestParam("toDate") String toDate,
@RequestParam(value = "limit", defaultValue = "10") Integer limit,
@RequestParam(value = "offset", defaultValue = "0") Integer offset) {
@RequestParam String fromDate,
@RequestParam String toDate,
@RequestParam(defaultValue = "10") Integer limit,
@RequestParam(defaultValue = "0") Integer offset) {
return searchService
.searchDateRange(fromDate, toDate, offset, limit)
.map(ResponseEntity::ok);
}

@GetMapping("/search/aggregate")
public Mono<ResponseEntity<AggregationSearchResponse>> aggregateSearch(
@RequestParam(name = "searchKeyword") String searchKeyword,
@RequestParam(name = "fieldNames") List<String> fieldNames,
@RequestParam(required = false, name = "limit", defaultValue = "15") Integer limit,
@RequestParam(required = false, name = "offset", defaultValue = "0") Integer offset,
@RequestParam(required = false, defaultValue = "DESC", name = "sortOrder")
String sortOrder,
@RequestParam(required = false, defaultValue = "restaurant_id", name = "sortFields")
String... sortFields) {
@RequestParam String searchKeyword,
@RequestParam List<String> fieldNames,
@RequestParam(required = false, defaultValue = "15") Integer limit,
@RequestParam(required = false, defaultValue = "0") Integer offset,
@RequestParam(required = false, defaultValue = "DESC") String sortOrder,
@RequestParam(required = false, defaultValue = "restaurant_id") String... sortFields) {
return searchService
.aggregateSearch(searchKeyword, fieldNames, sortOrder, limit, offset, sortFields)
.map(ResponseEntity::ok);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,13 @@ public RestaurantController(RestaurantService restaurantService) {

@GetMapping
public PagedResult<Restaurant> getAllRestaurants(
@RequestParam(
value = "pageNo",
defaultValue = AppConstants.DEFAULT_PAGE_NUMBER,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_PAGE_NUMBER, required = false)
int pageNo,
@RequestParam(
value = "pageSize",
defaultValue = AppConstants.DEFAULT_PAGE_SIZE,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_PAGE_SIZE, required = false)
int pageSize,
@RequestParam(
value = "sortBy",
defaultValue = AppConstants.DEFAULT_SORT_BY,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_SORT_BY, required = false)
String sortBy,
@RequestParam(
value = "sortDir",
defaultValue = AppConstants.DEFAULT_SORT_DIRECTION,
required = false)
@RequestParam(defaultValue = AppConstants.DEFAULT_SORT_DIRECTION, required = false)
String sortDir) {
return restaurantService.findAllRestaurants(pageNo, pageSize, sortBy, sortDir);
}
Expand Down
Loading

0 comments on commit c6cd3ce

Please sign in to comment.