RED-9270: Fixed download of report template, RED-9225: Minor fixes for new customer api

This commit is contained in:
Dominique Eifländer 2024-06-06 12:53:07 +02:00
parent dae360a7ac
commit 0f203d39a4
4 changed files with 14 additions and 3 deletions

View File

@ -44,7 +44,7 @@ public class DownloadControllerV2 implements DownloadResource {
.creationDate(status.getCreationDate())
.lastDownload(status.getLastDownload())
.fileSize(status.getFileSize())
.dossierId(status.getDossier().getId())
.dossierId(status.getDossier() != null ? status.getDossier().getId() : null)
.fileIds(status.getFiles()
.stream()
.map(FileEntity::getId)

View File

@ -50,7 +50,7 @@ public interface DownloadResource {
@ResponseStatus(value = HttpStatus.OK)
@Operation(summary = "Download the download package.")
@ApiResponses(value = {@ApiResponse(responseCode = "200", description = "Successfully downloaded the requested file."), @ApiResponse(responseCode = "404", description = "Download not found. This happens if the requested download does not exist for the current user.")})
@GetMapping(value = PATH + DOWNLOAD_ID_PATH_PARAM + DOWNLOAD_PATH)
@GetMapping(value = PATH + DOWNLOAD_ID_PATH_PARAM + DOWNLOAD_PATH, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_OCTET_STREAM_VALUE})
void download(@Parameter(name = DOWNLOAD_ID_PARAM, description = "The identifier for the file to download.", required = true) @PathVariable(DOWNLOAD_ID_PARAM) String downloadId);
}

View File

@ -149,7 +149,7 @@ public class DossierTemplateExportService {
objectMapper.writeValueAsBytes(convert(colors, Colors.class))));
// add dossier statuses
var dossierStatusList = dossierStatusPersistenceService.getAllDossierStatusForTemplate(dossierTemplateId);
var dossierStatusList = dossierStatusPersistenceService.getAllDossierStatusForTemplateWithoutSecurity(dossierTemplateId);
fileSystemBackedArchiver.addEntries(new FileSystemBackedArchiver.ArchiveModel(null,
getFilename(ExportFilename.DOSSIER_STATUS, JSON_EXT),
objectMapper.writeValueAsBytes(convert(dossierStatusList, DossierStatusInfo.class))));

View File

@ -104,6 +104,17 @@ public class DossierStatusPersistenceService {
}
@Transactional
public List<DossierStatusInfo> getAllDossierStatusForTemplateWithoutSecurity(String dossierTemplateId) {
return dossierStatusRepository.findByDossierTemplateIdIn(Collections.singletonList(dossierTemplateId))
.stream()
.map(d -> MagicConverter.convert(d, DossierStatusInfo.class))
.collect(Collectors.toList());
}
@Transactional
public List<DossierStatusInfo> getAllDossierStatuses(List<String> dossierTemplateIds) {