Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
refactoring in ForeignRulesController
Browse files Browse the repository at this point in the history
  • Loading branch information
gstoehld committed Apr 7, 2022
1 parent 7f5eb83 commit cf189f4
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
public class ForeignRulesControllerV2 {

private static final Logger logger = LoggerFactory.getLogger(ForeignRulesControllerV2.class);
public static final int FOREIGN_RULES_VALID_DURATION = 172800000;

private final ValueSetDataService valueSetDataService;
private final ForeignRulesDataService foreignRulesDataService;
Expand All @@ -54,11 +55,11 @@ public ForeignRulesControllerV2(
}

@GetMapping(value = "/foreignRules")
public @ResponseBody ResponseEntity<Map> getCountries(WebRequest request) {
public @ResponseBody ResponseEntity<Map> getCountries() {
var countries = foreignRulesDataService.getCountries();
HashMap<String, Object> res = new HashMap<>();
res.put("countries", countries);
res.put("validDuration", 172800000);
res.put("validDuration", FOREIGN_RULES_VALID_DURATION);
return ResponseEntity.ok().headers(getVerificationRulesHeaders()).body(res);
}

Expand All @@ -67,7 +68,7 @@ public ForeignRulesControllerV2(
@PathVariable("country") String country, WebRequest request) {
ObjectMapper mapper = new ObjectMapper();
Map<String, Object> result = new HashMap<>();
result.put("validDuration", 172800000);
result.put("validDuration", FOREIGN_RULES_VALID_DURATION);

// Add rules to output
var foreignRules = foreignRulesDataService.getRulesForCountry(country);
Expand Down

0 comments on commit cf189f4

Please sign in to comment.