Commit 14845e18 authored by Siiri Tann's avatar Siiri Tann
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Siiri Tann

See merge request teis/files-service!91
parents 67707acd cb2f71f7
# Changelog
## [2.3.0] - 2022-08-26
* TEIS-2706: added method getCurrentByFileIdAndObjectType
* TEIS-2697: added CASE_DOCUMENT minio bucket
## [2.2.0] - 2022-07-22
* TEIS-2693: added method to FileReferenceBusinessService
## [2.1.0] - 2022-07-20
* TEIS-2693: added method to FileReferenceBusinessService
......
theGroup=ee.sm.ti.teis
theVersion=2.2.0
commonsVersion=2.4.0
commonApiGatewayVersion=2.3.0
pluginVersion=2.1.0
schedulerVersion=1.18.0
theVersion=2.3.0
commonsVersion=2.7.0
commonApiGatewayVersion=2.6.0
pluginVersion=2.3.0
schedulerVersion=2.0.0
......@@ -109,6 +109,16 @@ public class FileReferenceBusinessService {
}
}
public FileReferenceDto getCurrentByFileIdAndObjectType(UUID fileId, ObjectType objectType,
RequestMetaDTO requestMetaDTO) {
Optional<FileReferenceEntity> fileReference = dataService.getCurrentByFileIdAndObjectType(fileId, objectType.getId());
if (fileReference.isEmpty()) {
throw new TeisResourceNotFoundException("Current file reference not found with File ID and object type", List.of(fileId, objectType));
} else {
return composeService.toDto(fileReference.get(), requestMetaDTO);
}
}
public FileReferenceEntity getByIdAndObjectType(UUID id, ObjectType objectType) {
Optional<FileReferenceEntity> fileReference = dataService.getByIdAndObjectType(id, objectType.getId());
if (fileReference.isEmpty()) {
......
......@@ -96,4 +96,9 @@ public class FileReferenceDataService {
public void delete(List<FileReferenceEntity> entities) {
repository.deleteAll(entities);
}
public Optional<FileReferenceEntity> getCurrentByFileIdAndObjectType(UUID fileId, String objectType) {
return repository.findCurrentByFileIdAndObjectType(fileId, objectType);
}
}
......@@ -68,4 +68,11 @@ public interface FileReferenceRepository extends JpaRepository<FileReferenceEnti
Optional<FileReferenceEntity> findByIdAndObjectTypeAndObjectStatus(UUID id, String objectType,
ObjectStatus objectStatus);
default Optional<FileReferenceEntity> findCurrentByFileIdAndObjectType(UUID fileId, String objectType) {
return findByFileIdAndObjectTypeAndObjectStatus(fileId, objectType, CURRENT);
}
Optional<FileReferenceEntity> findByFileIdAndObjectTypeAndObjectStatus(UUID fileId, String objectType,
ObjectStatus objectStatus);
}
......@@ -98,6 +98,9 @@ teis:
object-types: ACCIDENT_CASE
- bucket: teis-statistics
object-types: STATISTICS
- bucket: teis-casedocuments
thumbnail-bucket: teis-casedocuments-thumbnail
object-types: CASE_DOCUMENT
file:
virus-scan:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment