Merge branch 'RED-10315-master' into 'master'

RED-10315: hardDeleteCleanupRetryTime in app config endpoint optional

Closes RED-10315

See merge request redactmanager/persistence-service!806
This commit is contained in:
Dominique Eifländer 2024-10-30 09:56:44 +01:00
commit 437941fc6c
4 changed files with 25 additions and 3 deletions

View File

@ -13,7 +13,9 @@ import com.knecon.fforesight.databasetenantcommons.providers.utils.MagicConverte
import com.iqser.red.service.persistence.service.v1.api.external.resource.ApplicationConfigurationResource;
import com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.configuration.ApplicationConfig;
import jakarta.persistence.Column;
import jakarta.validation.Valid;
import lombok.Builder;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -29,7 +31,7 @@ public class ApplicationConfigurationController implements ApplicationConfigurat
@PreAuthorize("hasAuthority('" + WRITE_APP_CONFIG + "')")
public ApplicationConfig createOrUpdateAppConfig(@Valid @RequestBody ApplicationConfig appConfig) {
return MagicConverter.convert(applicationConfigService.saveApplicationConfiguration(MagicConverter.convert(appConfig, ApplicationConfigurationEntity.class)),
return MagicConverter.convert(applicationConfigService.saveApplicationConfiguration(convert(appConfig)),
ApplicationConfig.class);
}
@ -41,4 +43,18 @@ public class ApplicationConfigurationController implements ApplicationConfigurat
return MagicConverter.convert(applicationConfigService.getApplicationConfig(), ApplicationConfig.class);
}
private ApplicationConfigurationEntity convert(ApplicationConfig appConfig){
var entity = ApplicationConfigurationEntity.builder()
.downloadCleanupDownloadFilesHours(appConfig.getDownloadCleanupDownloadFilesHours())
.downloadCleanupNotDownloadFilesHours(appConfig.getDownloadCleanupNotDownloadFilesHours())
.softDeleteCleanupTime(appConfig.getSoftDeleteCleanupTime())
.build();
if(appConfig.getHardDeleteCleanupRetryTime() != null){
entity.setHardDeleteCleanupRetryTime(appConfig.getHardDeleteCleanupRetryTime());
}
return entity;
}
}

View File

@ -24,15 +24,19 @@ public class ApplicationConfigurationEntity {
private final String id = ApplicationConfigurationEntity.ID;
@Column
@Builder.Default
private int downloadCleanupDownloadFilesHours = 8;
@Column
@Builder.Default
private int downloadCleanupNotDownloadFilesHours = 72;
@Column
@Builder.Default
private int softDeleteCleanupTime = 96;
@Column
@Builder.Default
private int hardDeleteCleanupRetryTime = 72;
}

View File

@ -371,7 +371,7 @@ public class FileAttributeTest extends AbstractPersistenceServerServiceTest {
IOUtils.toByteArray(new ClassPathResource("files/csv/fileattributes_missing_quotation_mark.csv").getInputStream()));
result = assertThrows(FeignException.class, () -> uploadClient.upload(missingQuotation, dossier.getId(), false, false));
assertTrue(result.getMessage().contains("Invalid CSV file format: Unterminated quoted field at end of CSV line. Beginning of lost text: [4.636.0,4.363.0,4.363.0\\n]"));
assertTrue(result.getMessage().contains("Invalid CSV file format: Unterminated quoted field at end of CSV line. Beginning of lost text: [4.636.0,4.363.0,4.363.0\\n]") || result.getMessage().contains("Invalid CSV file format: Unterminiertes Anführungszeichen am Ende einer CSV-Zeile. Anfang des verlorenen Textes: [4.636.0,4.363.0,4.363.0\\n]"));
}
}

View File

@ -1,5 +1,6 @@
package com.iqser.red.service.persistence.service.v1.api.shared.model.dossiertemplate.configuration;
import jakarta.annotation.Nullable;
import jakarta.validation.constraints.Min;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -19,6 +20,7 @@ public class ApplicationConfig {
@Min(1)
private int softDeleteCleanupTime;
@Min(1)
private int hardDeleteCleanupRetryTime;
@Nullable
private Integer hardDeleteCleanupRetryTime;
}