Skip to content

Commit

Permalink
Merge pull request #181 from sunbird-cb/orgApiFixes
Browse files Browse the repository at this point in the history
Org Search Api Enhancements
  • Loading branch information
karthik-tarento authored Mar 21, 2023
2 parents 131c113 + 9dcc9b6 commit 31aea0b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 23 deletions.
26 changes: 20 additions & 6 deletions src/main/java/org/sunbird/common/model/SBApiOrgSearchRequest.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
package org.sunbird.common.model;

import java.util.HashMap;
import java.util.Map;

public class SBApiOrgSearchRequest {
private SBApiOrgFilterRequest filters = new SBApiOrgFilterRequest();
private SBApiSortByRequest sort_by = new SBApiSortByRequest();

private Map<String, String> sortBy = new HashMap<>();
private String query;

public String getQuery() {
return query;
}

public void setQuery(String query) {
this.query = query;
}

public SBApiOrgFilterRequest getFilters() {
return filters;
Expand All @@ -12,11 +25,12 @@ public void setFilters(SBApiOrgFilterRequest filters) {
this.filters = filters;
}

public SBApiSortByRequest getSort_by() {
return sort_by;
public Map<String, String> getSortBy() {
return sortBy;
}

public void setSort_by(SBApiSortByRequest sort_by) {
this.sort_by = sort_by;
public void setSortBy(Map<String, String> sortBy) {
this.sortBy = sortBy;
}
}

}
15 changes: 0 additions & 15 deletions src/main/java/org/sunbird/common/model/SBApiSortByRequest.java

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/java/org/sunbird/common/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,8 @@ public class Constants {
public static final String CHECKS = "checks";
public static final String CASSANDRA_DB = "cassandra db";
public static final String REDIS_CACHE = "redis cache";

public static final String QUERY = "query";
public static final String SORT_BY_KEYWORD = "sortBy";
private Constants() {
throw new IllegalStateException("Utility class");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ public SBApiResponse orgExtSearch(Map<String, Object> request) throws Exception
}).collect(Collectors.toList());
SBApiOrgSearchRequest orgSearchRequest = new SBApiOrgSearchRequest();
orgSearchRequest.getFilters().setId(orgIdList);

if(!ProjectUtil.isStringNullOREmpty((String) requestData.get(Constants.QUERY)))
{
orgSearchRequest.setQuery((String) requestData.get(Constants.QUERY));
}
orgSearchRequest.setSortBy((Map<String, String>) requestData.get(Constants.SORT_BY_KEYWORD));
Map<String, Object> orgSearchRequestBody = new HashMap<String, Object>() {
private static final long serialVersionUID = 1L;

Expand Down

0 comments on commit 31aea0b

Please sign in to comment.