Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/main/environment/common_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ km-base-path=@env.KM_API_BASE_PATH@
km-root-path=/okm:personal/users/
km-guest-user=@env.KM_GUEST_USER@
km-guest-password=@env.KM_GUEST_PASSWORD@
tempFilePath=@env.TEMP_FILE_PATH@

# CTI Config
cti-server-ip=@env.CTI_SERVER_IP@
Expand Down Expand Up @@ -193,15 +192,4 @@ cors.allowed-origins=@env.CORS_ALLOWED_ORIGINS@
video-call-url=@env.VIDEO_CALL_URL@
jibri.output.path=@env.JIBRI_OUTPUT_PATH@
video.recording.path=@env.VIDEO_RECORDING_PATH@

platform.feedback.ratelimit.enabled=@env.PLATFORM_FEEDBACK_RATELIMIT_ENABLED@
platform.feedback.ratelimit.pepper=@env.PLATFORM_FEEDBACK_RATELIMIT_PEPPER@
platform.feedback.ratelimit.trust-forwarded-for=@env.PLATFORM_FEEDBACK_RATELIMIT_TRUST_FORWARDED_FOR@
platform.feedback.ratelimit.forwarded-for-header=@env.PLATFORM_FEEDBACK_RATELIMIT_FORWARDED_FOR_HEADER@
platform.feedback.ratelimit.minute-limit=@env.PLATFORM_FEEDBACK_RATELIMIT_MINUTE_LIMIT@
platform.feedback.ratelimit.day-limit=@env.PLATFORM_FEEDBACK_RATELIMIT_DAY_LIMIT@
platform.feedback.ratelimit.user-day-limit=@env.PLATFORM_FEEDBACK_RATELIMIT_USER_DAY_LIMIT@
platform.feedback.ratelimit.fail-window-minutes=@env.PLATFORM_FEEDBACK_RATELIMIT_FAIL_WINDOW_MINUTES@
platform.feedback.ratelimit.backoff-minutes=@env.PLATFORM_FEEDBACK_RATELIMIT_BACKOFF_MINUTES@
generateBeneficiaryIDs-api-url=@env.GEN_BENEFICIARY_IDS_API_URL@

13 changes: 1 addition & 12 deletions src/main/environment/common_docker.properties
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ everwellRegisterBenficiary = ${COMMON_API_BASE_URL}/beneficiary/create
## LungAssessment credentials
lungAssessmentEmail = ${SWAASA_EMAIL}
lungAssessmentPassword =${SWAASA_PASSWORD}
tempFilePath=${TEMP_FILE_PATH}


## SWASSA APIs
lungAssessmentAdminLogin = ${SWAASA_BASE_URL}/api/adminLogin
Expand Down Expand Up @@ -195,15 +195,4 @@ firebase.credential-file=${FIREBASE_CREDENTIAL}
video-call-url=${VIDEO_CALL_URL}
jibri.output.path={JIBRI_OUTPUT_PATH}
video.recording.path={VIDEO_RECORDING_PATH}

# Platform Feedback module
platform.feedback.ratelimit.enabled=${PLATFORM_FEEDBACK_RATELIMIT_ENABLED}
platform.feedback.ratelimit.pepper=${PLATFORM_FEEDBACK_RATELIMIT_PEPPER}
platform.feedback.ratelimit.trust-forwarded-for=${PLATFORM_FEEDBACK_RATELIMIT_TRUST_FORWARDED_FOR}
platform.feedback.ratelimit.forwarded-for-header=${PLATFORM_FEEDBACK_RATELIMIT_FORWARDED_FOR_HEADER}
platform.feedback.ratelimit.minute-limit=${PLATFORM_FEEDBACK_RATELIMIT_MINUTE_LIMIT}
platform.feedback.ratelimit.day-limit=${PLATFORM_FEEDBACK_RATELIMIT_DAY_LIMIT}
platform.feedback.ratelimit.user-day-limit=${PLATFORM_FEEDBACK_RATELIMIT_USER_DAY_LIMIT}
platform.feedback.ratelimit.fail-window-minutes=${PLATFORM_FEEDBACK_RATELIMIT_FAIL_WINDOW_MINUTES}
platform.feedback.ratelimit.backoff-minutes=${PLATFORM_FEEDBACK_RATELIMIT_BACKOFF_MINUTES}
generateBeneficiaryIDs-api-url={GEN_BENEFICIARY_IDS_API_URL}
16 changes: 0 additions & 16 deletions src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -208,21 +208,5 @@ captcha.enable-captcha=true

cors.allowed-origins=http://localhost:*

# ---Platform Feedback module ---
# Rate limiter OFF locally (no Redis required)
platform.feedback.ratelimit.enabled=true
platform.feedback.ratelimit.pepper=dev-pepper-123 # dummy

# trust forwarded-for locally is harmless (localhost only)
platform.feedback.ratelimit.trust-forwarded-for=false
platform.feedback.ratelimit.forwarded-for-header=X-Forwarded-For

# Optional overrides (not needed if disabled)
platform.feedback.ratelimit.minute-limit=10
platform.feedback.ratelimit.day-limit=100
platform.feedback.ratelimit.user-day-limit=50
platform.feedback.ratelimit.fail-window-minutes=5
platform.feedback.ratelimit.backoff-minutes=15

### generate Beneficiary IDs URL
generateBeneficiaryIDs-api-url=/generateBeneficiaryController/generateBeneficiaryIDs
2 changes: 0 additions & 2 deletions src/main/java/com/iemr/common/CommonApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.client.RestTemplate;

Expand All @@ -41,7 +40,6 @@

@SpringBootApplication
@EnableScheduling
@EnableAsync
public class CommonApplication extends SpringBootServletInitializer {

@Bean
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/com/iemr/common/config/RedisConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import com.iemr.common.data.users.User;
import org.springframework.data.redis.core.StringRedisTemplate;

@Configuration
public class RedisConfig {
Expand All @@ -58,10 +57,4 @@ public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factor
return template;
}

// new bean for rate limiting & counters
@Bean
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory factory) {
return new StringRedisTemplate(factory);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.spec.InvalidKeySpecException;

import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.PBEKeySpec;

import org.springframework.stereotype.Service;

@Service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -71,8 +70,6 @@
import com.iemr.common.service.userbeneficiarydata.MaritalStatusService;
import com.iemr.common.service.userbeneficiarydata.StatusService;
import com.iemr.common.service.userbeneficiarydata.TitleService;
import com.iemr.common.utils.CookieUtil;
import com.iemr.common.utils.JwtUtil;
import com.iemr.common.utils.mapper.InputMapper;
import com.iemr.common.utils.mapper.OutputMapper;
import com.iemr.common.utils.response.OutputResponse;
Expand Down Expand Up @@ -106,8 +103,6 @@ public class BeneficiaryRegistrationController {
private BeneficiaryOccupationService beneficiaryOccupationService;
private GovtIdentityTypeService govtIdentityTypeService;

@Autowired
private JwtUtil jwtUtil;

@Autowired
public void setBenRelationshipTypeService(BenRelationshipTypeService benRelationshipTypeService) {
Expand Down Expand Up @@ -347,54 +342,6 @@ public String searchUserByPhone(
return response.toString();
}

@Operation(summary = "Provide the list of beneficiaries using Elasticsearch")
@RequestMapping(value = "/searchUser", method = RequestMethod.POST, headers = "Authorization")
public String searchUser(@RequestBody String request, HttpServletRequest httpRequest) {
OutputResponse response = new OutputResponse();
try {
logger.info("Universal search request received");

JsonParser parser = new JsonParser();
JsonObject requestObj = parser.parse(request).getAsJsonObject();

String searchQuery = null;
if (requestObj.has("search") && !requestObj.get("search").isJsonNull()) {
searchQuery = requestObj.get("search").getAsString();
}

if (searchQuery == null || searchQuery.trim().isEmpty()) {
response.setError(400, "Search query is required");
return response.toString();
}

String auth = httpRequest.getHeader("Authorization");

Integer userID = jwtUtil.getUserIdFromRequest(httpRequest);

logger.info("ES search for userId: {}", userID);

Boolean is1097 = false;
if (requestObj.has("is1097") && !requestObj.get("is1097").isJsonNull()) {
is1097 = requestObj.get("is1097").getAsBoolean();
}

logger.info("Searching with query: {}, userId: {}, is1097: {}", searchQuery, userID, is1097);
String result = iemrSearchUserService.searchUser(searchQuery, userID, auth, is1097);

if (result == null || result.trim().isEmpty()) {
response.setError(200, "No beneficiaries found");
return response.toString();
}

return result;

} catch (Exception e) {
logger.error("Error in universal search: {}", e.getMessage(), e);
response.setError(400, "Error searching beneficiaries: " + e.getMessage());
return response.toString();
}
}

@Operation(summary = "Provide the list of beneficiaries based on search criteria")
@RequestMapping(value = "/searchBeneficiary", method = RequestMethod.POST, headers = "Authorization")
public String searchBeneficiary(
Expand All @@ -417,41 +364,6 @@ public String searchBeneficiary(
return output.toString();
}

/**
* Elasticsearch-based advanced search endpoint
*/
@Operation(summary = "Advanced search beneficiaries using Elasticsearch")
@RequestMapping(value = "/searchBeneficiaryES", method = RequestMethod.POST, headers = "Authorization")
public String searchBeneficiaryES(
@RequestBody BeneficiaryModel request,
HttpServletRequest httpRequest) {

logger.info("searchBeneficiaryES request: {}", request);
OutputResponse output = new OutputResponse();

try {

String auth = httpRequest.getHeader("Authorization");

Integer userID = jwtUtil.getUserIdFromRequest(httpRequest);

logger.info("ES Advanced search for userId: {}", userID);

String result = iemrSearchUserService.findBeneficiaryES(request, userID, auth);

return result;

} catch (NumberFormatException ne) {
logger.error("searchBeneficiaryES failed with number format error: {}", ne.getMessage(), ne);
output.setError(400, "Invalid number format in search criteria");
return output.toString();
} catch (Exception e) {
logger.error("searchBeneficiaryES failed with error: {}", e.getMessage(), e);
output.setError(500, "Error searching beneficiaries: " + e.getMessage());
return output.toString();
}
}

@Operation(summary = "Provide all common data list needed for beneficiary registration")
@RequestMapping(value = "/getRegistrationData", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public String getRegistrationData() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public ResponseEntity<ApiResponse<?>> deleteField(@PathVariable Long fieldId) {
}

@GetMapping(value = "form/{formId}/fields")
public ResponseEntity<ApiResponse<?>> getStructuredForm(@PathVariable String formId, @RequestParam(name = "lang", defaultValue = "en") String lang,@RequestHeader(value = "jwttoken") String token) {
public ResponseEntity<ApiResponse<?>> getStructuredForm(@PathVariable String formId, @RequestParam(name = "lang", defaultValue = "en") String lang,@RequestHeader(value = "JwtToken") String token) {
try {
Object result = formMasterService.getStructuredFormByFormId(formId,lang,token);
return ResponseEntity.status(HttpStatus.OK)
Expand All @@ -97,6 +97,4 @@ public ResponseEntity<ApiResponse<?>> getStructuredForm(@PathVariable String for
}




}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ private void createUserMapping(User mUser, JSONObject resMap, JSONObject service
resMap.put("agentPassword", mUser.getAgentPassword());
resMap.put("m_UserLangMappings", new JSONArray(mUser.getM_UserLangMappings().toString()));
resMap.put("designationID", mUser.getDesignationID());
resMap.put("dhistoken",mUser.getDhistoken());
if (mUser.getDesignation() != null) {
resMap.put("designation", new JSONObject(mUser.getDesignation().toString()));
}
Expand Down Expand Up @@ -1224,25 +1223,7 @@ public ResponseEntity<?> getUserDetails(@PathVariable("userName") String userNam
return new ResponseEntity<>(Map.of("error", "UserName Not Found"), HttpStatus.NOT_FOUND);
}
User user = users.get(0);
return new ResponseEntity<>(Map.of("userName", user.getUserName(), "userId", user.getUserID()),
HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(Map.of("error", "Internal server error"), HttpStatus.INTERNAL_SERVER_ERROR);
}

}

@Operation(summary = "Get UserId based on userName")
@GetMapping(value = "/checkUserName/{userName}", produces = MediaType.APPLICATION_JSON, headers = "Authorization")
public ResponseEntity<?> checkUserDetails(@PathVariable("userName") String userName) {
try {
List<User> users = iemrAdminUserServiceImpl.findUserIdByUserName(userName);
if (users.isEmpty()) {
return new ResponseEntity<>(Map.of("error", "UserName Not Found"), HttpStatus.NOT_FOUND);
}
User user = users.get(0);
return new ResponseEntity<>(Map.of("userName", user.getUserName(), "userId", user.getUserID()),
HttpStatus.OK);
return new ResponseEntity<>(Map.of("userName", user.getUserName(), "userId", user.getUserID()), HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(Map.of("error", "Internal server error"), HttpStatus.INTERNAL_SERVER_ERROR);
}
Expand Down
Loading
Loading