DM-504: always exclude hard deleted files

This commit is contained in:
Kilian Schuettler 2023-10-06 15:11:09 +02:00
parent 670b60041c
commit f706619140
2 changed files with 9 additions and 2 deletions

View File

@ -6,6 +6,7 @@ import static com.iqser.red.service.persistence.service.v2.api.external.resource
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierResource.INCLUDE_SOFT_DELETED_PARAM;
import static com.iqser.red.service.persistence.service.v2.api.external.resource.DossierTemplateResource.DOSSIER_TEMPLATE_ID_PARAM;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@ -94,10 +95,14 @@ public class FileControllerV2 implements FileResource {
dossierController.getDossier(dossierId, true, includeSoftDeleted);
var status = statusController.getFileStatus(dossierId, fileId);
FileStatus status = statusController.getFileStatus(dossierId, fileId);
if (status.getHardDeletedTime() != null) {
throw new NotFoundException(String.format("The requested file has been hard deleted on %s.", status.getHardDeletedTime().format(DateTimeFormatter.ISO_LOCAL_DATE)));
}
if (!includeSoftDeleted && status.getSoftDeletedTime() != null) {
throw new NotFoundException("The requested file does not exist.");
throw new NotFoundException(String.format("The requested file has been soft deleted on %s.", status.getSoftDeletedTime().format(DateTimeFormatter.ISO_LOCAL_DATE)));
}
return status;

View File

@ -123,6 +123,8 @@ public class FileStatus {
private Set<Integer> excludedPages;
@Schema(description = "Shows if the file is soft deleted.")
private OffsetDateTime softDeletedTime;
@Schema(description = "Shows if the file is hard deleted.")
private OffsetDateTime hardDeletedTime;
@Schema(description = "Date and time when the files attributes was last updated.")
private OffsetDateTime lastFileAttributeChange;
@Schema(description = "Shows if there are any Suggestions in this file.")