Skip to content
Closed
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
3 changes: 3 additions & 0 deletions src/main/environment/common_ci.properties
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,6 @@ logging.file.name=@env.HWC_API_LOGGING_FILE_NAME@
springdoc.api-docs.enabled=@env.SWAGGER_DOC_ENABLED@
springdoc.swagger-ui.enabled=@env.SWAGGER_DOC_ENABLED@

cors.allowed-origins=@CORS_ALLOWED_ORIGINS@


2 changes: 2 additions & 0 deletions src/main/environment/common_example.properties
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,6 @@ spring.redis.port=6379
springdoc.api-docs.enabled=true
springdoc.swagger-ui.enabled=true

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


24 changes: 24 additions & 0 deletions src/main/java/com/iemr/hwc/config/CorsConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.iemr.hwc.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class CorsConfig implements WebMvcConfigurer {

@Value("${cors.allowed-origins}")
private String allowedOrigins;

@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns(allowedOrigins.split(","))
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
.allowedHeaders("*")
.exposedHeaders("Authorization", "Jwttoken") // Explicitly expose headers if needed
.allowCredentials(true)
.maxAge(3600);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
Expand All @@ -46,7 +45,6 @@

import io.swagger.v3.oas.annotations.Operation;

@CrossOrigin
@RestController
@RequestMapping(value = "/child-adolescent-care", headers = "Authorization")
public class ChildhoodAdolescenceController {
Expand All @@ -61,7 +59,7 @@ public class ChildhoodAdolescenceController {
* @return success or failure response with visit code
* @throws Exception
*/
@CrossOrigin

@Operation(summary = "Save child adolescent care (CAC) nurse data")
@PostMapping(value = { "/save/nurseData" })
public String saveBenNurseDataCAC(@RequestBody String requestObj,
Expand Down Expand Up @@ -94,7 +92,6 @@ public String saveBenNurseDataCAC(@RequestBody String requestObj,
return response.toString();
}

@CrossOrigin
@Operation(summary = "Save child adolescent care doctor data")
@PostMapping(value = { "save/doctorData" })
public String saveDoctorDataCAC(@RequestBody String requestObj,
Expand Down Expand Up @@ -128,7 +125,7 @@ public String saveDoctorDataCAC(@RequestBody String requestObj,
* @param comingRequest
* @return visit details in JSON format
*/
@CrossOrigin()

@Operation(summary = "Get beneficiary visit details from nurse for child adolescent care")
@PostMapping(value = { "/getBenVisitDetailsFrmNurseCAC" })
@Transactional(rollbackFor = Exception.class)
Expand Down Expand Up @@ -163,7 +160,6 @@ public String getBenVisitDetailsFrmNurseCAC(
* @return history details in JSON format
*/

@CrossOrigin()
@Operation(summary = "Get child adolescent care beneficiary history")
@PostMapping(value = { "/getBenHistoryDetails" })

Expand Down Expand Up @@ -196,7 +192,6 @@ public String getBenHistoryDetails(
* @return vital details in JSON format
*/

@CrossOrigin()
@Operation(summary = "Get child adolescent care beneficiary vitals from nurse")
@PostMapping(value = { "/getBenVitalDetailsFrmNurse" })
public String getBenVitalDetailsFrmNurse(
Expand Down Expand Up @@ -231,7 +226,6 @@ public String getBenVitalDetailsFrmNurse(
* @return immunization service details in JSON format
*/

@CrossOrigin()
@Operation(summary = "Get child adolescent care beneficiary immunization details")
@PostMapping(value = { "/getBenImmunizationServiceDetails" })

Expand Down Expand Up @@ -265,7 +259,6 @@ public String getBenImmunizationServiceDetails(
* @return doctor details in JSON format
*/

@CrossOrigin()
@Operation(summary = "Get child adolescent care beneficiary details entered by doctor")
@PostMapping(value = { "/getBenCaseRecordFromDoctor" })
@Transactional(rollbackFor = Exception.class)
Expand Down Expand Up @@ -299,7 +292,7 @@ public String getBenCaseRecordFromDoctor(
* @param comingRequest
* @return vital details in JSON format
*/
@CrossOrigin

@Operation(summary = "Update child adolescent care beneficiary vitals")
@PostMapping(value = { "/update/vitalScreen" })
public String updateVitalNurseCAC(@RequestBody String requestObj) {
Expand Down Expand Up @@ -334,7 +327,6 @@ public String updateVitalNurseCAC(@RequestBody String requestObj) {
* @return history details in JSON format
*/

@CrossOrigin
@Operation(summary = "Update birth and immunization history")
@PostMapping(value = { "/update/BirthAndImmunizationHistoryScreen" })
public String updateBirthAndImmunizationHistoryNurse(@RequestBody String requestObj) {
Expand Down Expand Up @@ -370,7 +362,6 @@ public String updateBirthAndImmunizationHistoryNurse(@RequestBody String request
* @return immunization service details in JSON format
*/

@CrossOrigin
@Operation(summary = "Update immunization service data")
@PostMapping(value = { "/update/ImmunizationServicesScreen" })
public String updateImmunizationServicesNurse(@RequestBody String requestObj) {
Expand Down Expand Up @@ -405,7 +396,6 @@ public String updateImmunizationServicesNurse(@RequestBody String requestObj) {
* @return doctor details in JSON format
*/

@CrossOrigin
@Operation(summary = "Update child adolescent care doctor data")
@PostMapping(value = { "/update/doctorData" })
public String updateCACDoctorData(@RequestBody String requestObj,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
Expand All @@ -53,7 +52,6 @@
*
*/

@CrossOrigin
@RestController
@RequestMapping(value = "/ANC", headers = "Authorization", consumes = "application/json", produces = "application/json")
public class AntenatalCareController {
Expand All @@ -69,7 +67,6 @@ public class AntenatalCareController {
* @throws Exception
*/

@CrossOrigin
@Operation(summary = "Save ANC nurse data")
@PostMapping(value = { "/save/nurseData" })
public String saveBenANCNurseData(@RequestBody String requestObj,
Expand Down Expand Up @@ -107,7 +104,7 @@ public String saveBenANCNurseData(@RequestBody String requestObj,
* @param JSON requestObj
* @return success or failure response
*/
@CrossOrigin

@Operation(summary = "Save ANC doctor data")
@PostMapping(value = { "/save/doctorData" })
public String saveBenANCDoctorData(@RequestBody String requestObj,
Expand Down Expand Up @@ -144,7 +141,6 @@ public String saveBenANCDoctorData(@RequestBody String requestObj,
* @return visit details in JSON format
*/

@CrossOrigin()
@Operation(summary = "Get ANC beneficiary visit details from nurse")
@PostMapping(value = { "/getBenVisitDetailsFrmNurseANC" })
@Transactional(rollbackFor = Exception.class)
Expand Down Expand Up @@ -177,7 +173,7 @@ public String getBenVisitDetailsFrmNurseANC(
* @param benRegID and benVisitID
* @return anc care details in JSON format
*/
@CrossOrigin()

@Operation(summary = "Get ANC beneficiary details from nurse")
@PostMapping(value = { "/getBenANCDetailsFrmNurseANC" })
@Transactional(rollbackFor = Exception.class)
Expand Down Expand Up @@ -214,7 +210,7 @@ public String getBenANCDetailsFrmNurseANC(
* @param benRegID and benVisitID
* @return history details in JSON format
*/
@CrossOrigin()

@Operation(summary = "Get ANC beneficiary history from nurse")
@PostMapping(value = { "/getBenANCHistoryDetails" })

Expand Down Expand Up @@ -247,7 +243,7 @@ public String getBenANCHistoryDetails(
* @param benRegID and benVisitID
* @return vital details in JSON format
*/
@CrossOrigin()

@Operation(summary = "Get ANC beneficiary vitals from nurse")
@PostMapping(value = { "/getBenANCVitalDetailsFrmNurseANC" })
public String getBenANCVitalDetailsFrmNurseANC(
Expand Down Expand Up @@ -280,7 +276,7 @@ public String getBenANCVitalDetailsFrmNurseANC(
* @param benRegID and benVisitID
* @return examination details in JSON format
*/
@CrossOrigin()

@Operation(summary = "Get ANC beneficiary examination details from nurse")
@PostMapping(value = { "/getBenExaminationDetailsANC" })

Expand Down Expand Up @@ -313,7 +309,7 @@ public String getBenExaminationDetailsANC(
* @param benRegID and benVisitID
* @return doctor entered details in JSON format
*/
@CrossOrigin()

@Operation(summary = "Get ANC beneficiary case record")
@PostMapping(value = { "/getBenCaseRecordFromDoctorANC" })
@Transactional(rollbackFor = Exception.class)
Expand Down Expand Up @@ -342,7 +338,6 @@ public String getBenCaseRecordFromDoctorANC(
return response.toString();
}

@CrossOrigin()
@Operation(summary = "Check high risk pregnancy status for ANC beneficiary")
@PostMapping(value = { "/getHRPStatus" })
@Transactional(rollbackFor = Exception.class)
Expand All @@ -366,7 +361,6 @@ public String getHRPStatus(@RequestBody HrpStatusAndReasonsRequestModel hrpStatu
@Autowired
private ANCService aNCService;

@CrossOrigin()
@Operation(summary = "Get high risk pregnancy information (status and reason) from obstetric history "
+ "as per the latest visit")
@PostMapping(value = { "/getHrpInformation" })
Expand Down Expand Up @@ -399,7 +393,6 @@ public String getHrpInformation(
* Doctor
*/

@CrossOrigin
@Operation(summary = "Update ANC beneficiary data")
@PostMapping(value = { "/update/ANCScreen" })
public String updateANCCareNurse(@RequestBody String requestObj) {
Expand Down Expand Up @@ -436,7 +429,6 @@ public String updateANCCareNurse(@RequestBody String requestObj) {
* by Doctor
*/

@CrossOrigin
@Operation(summary = "Update ANC beneficiary history")
@PostMapping(value = { "/update/historyScreen" })
public String updateANCHistoryNurse(@RequestBody String requestObj) {
Expand Down Expand Up @@ -473,7 +465,6 @@ public String updateANCHistoryNurse(@RequestBody String requestObj) {
* by Doctor
*/

@CrossOrigin
@Operation(summary = "Update ANC beneficiary vitals")
@PostMapping(value = { "/update/vitalScreen" })
public String updateANCVitalNurse(@RequestBody String requestObj) {
Expand Down Expand Up @@ -510,7 +501,6 @@ public String updateANCVitalNurse(@RequestBody String requestObj) {
* by Doctor
*/

@CrossOrigin
@Operation(summary = "Update ANC examination data")
@PostMapping(value = { "/update/examinationScreen" })
public String updateANCExaminationNurse(@RequestBody String requestObj) {
Expand Down Expand Up @@ -546,7 +536,7 @@ public String updateANCExaminationNurse(@RequestBody String requestObj) {
* @objective Replace ANC doctor data for the doctor next visit
*
*/
@CrossOrigin

@Operation(summary = "Update ANC doctor data")
@PostMapping(value = { "/update/doctorData" })
public String updateANCDoctorData(@RequestBody String requestObj,
Expand Down
Loading
Loading