Skip to content

Commit

Permalink
[Fix partially kbss-cvut/record-manager-ui#180] publishRecords does n…
Browse files Browse the repository at this point in the history
…othing when publishServiceUrl is not configured.
  • Loading branch information
kostobog authored and blcham committed Jul 21, 2024
1 parent 228584a commit 890d97e
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,19 @@ public ResponseEntity<Void> createRecord(@RequestBody PatientRecord record) {
public RecordImportResult publishRecords(
@RequestParam(name = "institution", required = false) String institutionKey,
@RequestParam(required = false) MultiValueMap<String, String> params){
String publishServiceUrl = configReader.getConfig(ConfigParam.PUBLISH_SERVICE_URL);
if(publishServiceUrl == null || publishServiceUrl.isBlank()) {
LOG.info("No publish service url provided, noop.");
RecordImportResult result = new RecordImportResult(0);
result.addError("Cannot publish completed records. Publish server not configured.");
return result;
}

// TODO fetch records completed records
// final Page<PatientRecord> result = recordService.findAllFull(RecordFilterMapper.constructRecordFilter(params),
// RestUtils.resolvePaging(params));
// List<PatientRecord> records = result.getContent();
List<PatientRecord> records = new ArrayList<>();
String publishServiceUrl = configReader.getConfig(ConfigParam.PUBLISH_SERVICE_URL);
LOG.debug("Publishing records.");
RecordImportResult response = restTemplate.postForEntity(URI.create(publishServiceUrl), records, RecordImportResult.class).getBody();

Expand Down

0 comments on commit 890d97e

Please sign in to comment.