Commit a30e0dbd authored by Enriko Käsper's avatar Enriko Käsper
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Enriko Käsper

See merge request teis/files-service!15
parents b47d4833 f02b6528
Subproject commit 4cc0c5b4d4bdbda2ae6a33ba337e3be218799eeb
Subproject commit ea6a5ec3ed936121c971ce84c1cc87ade857c3e1
theGroup=ee.sm.ti.teis
theVersion=1.0.0
theVersion=1.1.0
pluginVersion=1.0.0
commonsVersion=1.1.0
commonApiGatewayVersion=1.0.0
commonsVersion=1.3.0
commonApiGatewayVersion=1.3.0
mapstructVersion=1.3.0.Final
querydslVersion=4.1.3
......@@ -55,6 +55,7 @@ public class FileReferenceBusinessService {
return composeService.toDto(savedEntity, requestMetaDTO);
}
@Transactional
public List<FileReferenceDto> getFilesMetadata(UUID objectId, RequestMetaDTO requestMetaDTO) {
List<FileReferenceEntity> entities = dataService.getCurrentByObjectId(objectId);
return composeService.toDtoList(entities, requestMetaDTO);
......
......@@ -12,6 +12,7 @@ import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import ee.sm.ti.teis.types.enums.classifier.CreatorType;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.List;
import static ee.sm.ti.teis.servicerequest.UserType.getCreatorType;
......@@ -69,6 +70,7 @@ public class FileReferenceComposeService {
return mapper.toFileDomain(entity);
}
@Transactional
FileReferenceDto toDto(FileReferenceEntity entity, RequestMetaDTO requestMetaDTO) {
FileReferenceDto dto = mapper.toDto(entity);
......@@ -90,6 +92,7 @@ public class FileReferenceComposeService {
return dto;
}
@Transactional
List<FileReferenceDto> toDtoList(List<FileReferenceEntity> entities, RequestMetaDTO requestMetaDTO) {
return entities.stream().map(entity -> toDto(entity, requestMetaDTO)).collect(toList());
}
......
......@@ -7,15 +7,11 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Map;
import java.util.UUID;
@Entity
......@@ -39,7 +35,9 @@ public class FileReferenceEntity extends AuditedEntity {
@NotNull
private String objectType;
private String contextType;
private String context;
@Column(columnDefinition = "jsonb")
@Type(type = "jsonb")
private Map<String, Object> context;
@NotNull
private String creatorType;
private String fileName;
......
......@@ -19,4 +19,10 @@ create table file_reference
context_type varchar(255),
context varchar(255),
creator_type varchar(255)
);
\ No newline at end of file
);
--changeset hando:2020-04-21.alter-file-reference-context
alter table file_reference alter column context type jsonb USING context::jsonb;
--changeset enriko:2020-04-23.grant-delete-privilege
GRANT DELETE ON file_reference TO ${db_app_username};
......@@ -50,6 +50,7 @@ teis:
ms-exchange-name: ms_exchange
ms-exchange-reply-timeout: ${RABBIT_TEMPLATE_MS_EXCHANGE_REPLY_TIMEOUT:5000}
cs-exchange-name: cache_exchange
od-exchange-name: od-disabled
test:
data:
resetmagic: ${TEST_DATA_RESET_MAGIC:}
......
--liquibase formatted sql
--changeset enriko:2020-04-23.grant-delete-privilege runOnChange:true
GRANT DELETE ON file TO ${db_app_username};
GRANT DELETE ON file_pointer TO ${db_app_username};
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