Commit 7182889d authored by Jürgen Hannus's avatar Jürgen Hannus
Browse files

Merge branch 'develop' into 'master'

Release: merge 'develop' into 'master' created by Jürgen Hannus

See merge request teis/admin-service!37
parents 7f6dce10 95e2b5b8
# Changelog
## [1.15.0] - 2021-02-08
* functionality to fetch admin parameters
* added data migration SQL
* Added jpeg as a valid image extension for parameter FILE_UPLOAD_ALLOWED_RISK_FACTOR_IMAGE_EXTENSIONS
* functionality to create audit log entry with a reason for official to provide reason why risk assessment was viewed
* updated functionality for update parameter value to return AdminParameterDto instead of ParameterDto
## [1.14.0] - 2021-01-25
* Enable new-violation-elimination Feature Flag.
......
theGroup=ee.sm.ti.teis
theVersion=1.14.0
theVersion=1.15.0
pluginVersion=1.2.0
commonsVersion=1.18.0
commonApiGatewayVersion=1.18.0
commonsVersion=1.19.0-SNAPSHOT
commonApiGatewayVersion=1.19.0-SNAPSHOT
package ee.sm.ti.teis.adminservice.parameter.listener;
import ee.sm.ti.teis.AdminAppTestBase;
import ee.sm.ti.teis.commongateway.parameter.dto.AdminParameterDto;
import ee.sm.ti.teis.commongateway.parameter.request.AdminParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.response.AdminParametersResponse;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashSet;
import java.util.List;
import java.util.UUID;
import static ee.sm.ti.teis.servicerequest.UserType.OFFICIAL_USER;
import static ee.sm.ti.teis.servicerequest.UserType.PERSON;
import static ee.sm.ti.teis.types.enums.DataType.TEXT;
import static ee.sm.ti.teis.types.enums.RolePrivilegeCode.TI_MANAGE_PARAMETERS;
import static ee.sm.ti.teis.types.enums.ScopeType.PUBLIC;
import static ee.sm.ti.teis.utils.TestUtils.assertResponseForbidden;
import static ee.sm.ti.teis.utils.TestUtils.createRequestMeta;
import static java.util.Collections.emptyList;
import static java.util.Collections.singletonList;
import static java.util.UUID.randomUUID;
import static org.assertj.core.api.Assertions.assertThat;
public class AdminParameterGwListenerTest extends AdminAppTestBase {
private static final String PARAMETER_CODE_TRIPLEDEV = "X-TEST-TRIPLEDEV_URL";
AdminParametersRequest request;
RequestMetaDTO requestMetaDTO;
@Autowired
ParameterGwListener listener;
@BeforeEach
void setUp() {
requestMetaDTO = createRequestMeta(UUID.randomUUID().toString(), OFFICIAL_USER, randomUUID().toString(),
List.of(TI_MANAGE_PARAMETERS.name()));
request = new AdminParametersRequest();
request.setRequestMetaDTO(requestMetaDTO);
}
@Test
void getAdminParameters_privilegeMissing_forbidden() {
requestMetaDTO.setPrivileges(emptyList());
request.setPayload(null, requestMetaDTO);
AdminParametersResponse response = listener.getAdminParameters(request);
assertResponseForbidden(response.getError());
}
@Test
void getAdminParameters_wrongUserType_forbidden() {
requestMetaDTO.setUserType(PERSON);
request.setPayload(null, requestMetaDTO);
AdminParametersResponse response = listener.getAdminParameters(request);
assertResponseForbidden(response.getError());
}
@Test
void getAdminParameters_success() {
request.setPayload(null, requestMetaDTO);
AdminParametersResponse response = listener.getAdminParameters(request);
assertThat(response.getPayload().size()).isGreaterThanOrEqualTo(10);
AdminParameterDto dto = response.getPayload().stream()
.filter(parameter -> parameter.getCode().equals(PARAMETER_CODE_TRIPLEDEV))
.findFirst()
.orElse(new AdminParameterDto());
assertThat(dto.getName()).isEqualTo("Tripledev URL");
assertThat(dto.getValue()).isEqualTo("https://tripledev.ee");
assertThat(dto.getMandatory()).isTrue();
assertThat(dto.getDataType()).isEqualTo(TEXT);
assertThat(dto.getFrequentlyChanged()).isTrue();
assertThat(dto.getScopes()).isEqualTo(new HashSet<>(singletonList(PUBLIC)));
}
}
package ee.sm.ti.teis.adminservice.parameter.listener;
import ee.sm.ti.teis.AdminAppTestBase;
import ee.sm.ti.teis.commongateway.parameter.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.ParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.ParametersResponse;
import ee.sm.ti.teis.commongateway.parameter.dto.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.request.ParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.response.ParametersResponse;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
......@@ -24,16 +24,18 @@ import static org.assertj.core.api.Assertions.assertThat;
public class ParameterGwListenerTest extends AdminAppTestBase {
public static final String PARAMETER_CODE_TEHIK = "X-TEST-TEHIK_URL";
public static final String PARAMETER_CODE_NETI = "X-TEST-NETI_URL";
public static final String PARAMETER_CODE_TEATMIK = "LEGAL_PERSON_TEATMIK_WEB_LINK";
public static final String PARAMETER_CODE_GOOGLE = "X-TEST-GOOGLE_URL";
public static final String PARAMETER_CODE_ITI = "LEGAL_PERSON_ITI_WEB_LINK";
@Autowired
private ParameterGwListener listener;
private static final String PARAMETER_CODE_TEHIK = "X-TEST-TEHIK_URL";
private static final String PARAMETER_CODE_NETI = "X-TEST-NETI_URL";
private static final String PARAMETER_CODE_TEATMIK = "LEGAL_PERSON_TEATMIK_WEB_LINK";
private static final String PARAMETER_CODE_GOOGLE = "X-TEST-GOOGLE_URL";
private static final String PARAMETER_CODE_ITI = "LEGAL_PERSON_ITI_WEB_LINK";
private static final String PARAMETER_CODE_TRIPLEDEV = "X-TEST-TRIPLEDEV_URL";
ParametersRequest request;
RequestMetaDTO requestMetaDTO;
private ParametersRequest request;
private RequestMetaDTO requestMetaDTO;
@Autowired
ParameterGwListener listener;
@BeforeEach
void setUp() {
......@@ -51,7 +53,7 @@ public class ParameterGwListenerTest extends AdminAppTestBase {
ParametersResponse response = listener.getParameters(request);
assertThat(response.getPayload().size()).isGreaterThanOrEqualTo(2);
assertThat(response.getPayload()).extracting("code").contains(PARAMETER_CODE_TEHIK, PARAMETER_CODE_NETI);
assertThat(response.getPayload()).extracting("code").contains(PARAMETER_CODE_TEHIK, PARAMETER_CODE_NETI, PARAMETER_CODE_TRIPLEDEV);
assertThat(response.getPayload()).extracting("code").doesNotContain(PARAMETER_CODE_TEATMIK, PARAMETER_CODE_GOOGLE);
ParameterDto dto = response.getPayload().stream()
......@@ -72,7 +74,7 @@ public class ParameterGwListenerTest extends AdminAppTestBase {
assertThat(response.getPayload().size()).isGreaterThanOrEqualTo(3);
assertThat(response.getPayload()).extracting("code").contains(PARAMETER_CODE_TEHIK,
PARAMETER_CODE_TEATMIK, PARAMETER_CODE_ITI);
PARAMETER_CODE_TEATMIK, PARAMETER_CODE_ITI, PARAMETER_CODE_TRIPLEDEV);
assertThat(response.getPayload()).extracting("code").doesNotContain(PARAMETER_CODE_NETI, PARAMETER_CODE_GOOGLE);
ParameterDto dto = response.getPayload().stream()
......@@ -93,7 +95,7 @@ public class ParameterGwListenerTest extends AdminAppTestBase {
assertThat(response.getPayload().size()).isGreaterThanOrEqualTo(5);
assertThat(response.getPayload()).extracting("code").contains(PARAMETER_CODE_TEHIK,
PARAMETER_CODE_TEATMIK, PARAMETER_CODE_ITI, PARAMETER_CODE_NETI, PARAMETER_CODE_GOOGLE);
PARAMETER_CODE_TEATMIK, PARAMETER_CODE_ITI, PARAMETER_CODE_NETI, PARAMETER_CODE_GOOGLE, PARAMETER_CODE_TRIPLEDEV);
}
@Test
......
package ee.sm.ti.teis.adminservice.parameter.listener;
import ee.sm.ti.teis.AdminAppTestBase;
import ee.sm.ti.teis.commongateway.parameter.dto.AdminParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.UpdateParameterValueDto;
import ee.sm.ti.teis.commongateway.parameter.request.UpdateParameterValueRequest;
import ee.sm.ti.teis.commongateway.parameter.response.UpdateParameterValueResponse;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import static ee.sm.ti.teis.servicerequest.UserType.OFFICIAL_USER;
import static ee.sm.ti.teis.types.enums.DataType.INT;
import static ee.sm.ti.teis.types.enums.RolePrivilegeCode.TI_MANAGE_PARAMETERS;
import static ee.sm.ti.teis.utils.TestUtils.*;
import static java.util.Collections.emptyList;
import static java.util.UUID.randomUUID;
import static org.assertj.core.api.Assertions.assertThat;
public class UpdateParameterValueGwListenerTest extends AdminAppTestBase {
private static final String CODE = "X-TEST-TRIPLEDEV_REG_CODE";
UpdateParameterValueRequest request;
RequestMetaDTO requestMetaDTO;
UpdateParameterValueDto payload;
@Autowired
ParameterGwListener listener;
@BeforeEach
void setUp() {
requestMetaDTO = createRequestMeta(randomUUID().toString(), OFFICIAL_USER, randomUUID().toString(),
List.of(TI_MANAGE_PARAMETERS.name()));
payload = new UpdateParameterValueDto();
payload.setCode("X-TEST-TEHIK_URL");
request = new UpdateParameterValueRequest();
request.setPayload(payload, requestMetaDTO);
}
@Test
void updateParameterValue_privilegeMissing_forbidden() {
request.getRequestMetaDTO().setPrivileges(emptyList());
UpdateParameterValueResponse response = listener.updateParameterValue(request);
assertResponseForbidden(response.getError());
}
@Test
void updateParameterValue_codeMissing_badRequest() {
request.getPayload().setCode(null);
UpdateParameterValueResponse response = listener.updateParameterValue(request);
assertBadRequest(response.getError());
assertThat(response.getError().getViolations().get(0).getFieldName()).isEqualTo("updateParameterValue.code");
}
@Test
void updateParameterValue_codeNotExists_notFound() {
request.getPayload().setCode(randomUUID().toString());
UpdateParameterValueResponse response = listener.updateParameterValue(request);
assertResponseNotFound(response.getError());
}
@Test
void updateParameterValue_valueMandatory_valueMissing_badRequest() {
request.getPayload().setCode("X-TEST-TRIPLEDEV_URL");
UpdateParameterValueResponse response = listener.updateParameterValue(request);
assertBadRequest(response.getError());
assertThat(response.getError().getMessage()).isEqualTo("Value is required");
}
@Test
void updateParameterValue_dataTypeInt_valueNotNumeric_badRequest() {
request.getPayload().setCode(CODE);
request.getPayload().setValue("test 123");
UpdateParameterValueResponse response = listener.updateParameterValue(request);
assertBadRequest(response.getError());
assertThat(response.getError().getMessage()).isEqualTo("Value must be numeric");
}
@Test
void updateParameterValue_dataTypeInt_valueNotPositiveInteger_badRequest() {
request.getPayload().setCode(CODE);
request.getPayload().setValue("-2143");
UpdateParameterValueResponse response = listener.updateParameterValue(request);
assertBadRequest(response.getError());
assertThat(response.getError().getMessage()).isEqualTo("Value must be numeric");
}
@Test
@Transactional
void updateParameterValue_success() {
request.getPayload().setCode(CODE);
request.getPayload().setValue("123");
UpdateParameterValueResponse response = listener.updateParameterValue(request);
AdminParameterDto dto = response.getPayload();
assertThat(dto.getCode()).isEqualTo(request.getPayload().getCode());
assertThat(dto.getValue()).isEqualTo(request.getPayload().getValue());
assertThat(dto.getMandatory()).isTrue();
assertThat(dto.getFrequentlyChanged()).isTrue();
assertThat(dto.getDataType()).isEqualTo(INT);
}
}
......@@ -4,7 +4,9 @@ import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.admin.CalculateDeadlineGwRequest;
import ee.sm.ti.teis.commongateway.admin.FeatureFlagRequest;
import ee.sm.ti.teis.commongateway.admin.GetPathRequest;
import ee.sm.ti.teis.commongateway.parameter.ParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.request.AdminParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.request.ParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.request.UpdateParameterValueRequest;
import ee.sm.ti.teis.configuration.QueueList;
import ee.sm.ti.teis.configuration.TeisQueue;
import ee.sm.ti.teis.domain.admin.*;
......@@ -27,6 +29,8 @@ public class AdminQueueConfig implements QueueList {
public static final String GW_CALCULATE_DEADLINE_QUEUE = "admin-service.gw.calculateDeadlineRequests";
public static final String GW_PARAMETERS_QUEUE = "admin-service.gw.parametersRequests";
public static final String GW_UPDATE_PARAMETER_VALUE_QUEUE = "admin-service.gw.updateParameterValueRequests";
public static final String GW_ADMIN_PARAMETERS_QUEUE = "admin-service.gw.adminParametersRequests";
public static final String GW_GET_PATH_QUEUE = "admin-service.gw.getPathRequests";
public static final String GW_FEATURE_FLAG_QUEUE = "admin-service.gw.getFeatureFlagRequests";
......@@ -42,6 +46,8 @@ public class AdminQueueConfig implements QueueList {
addGwQueue(queues, "gwCalculateDeadlineQueue", CalculateDeadlineGwRequest.ROUTING_KEY, GW_CALCULATE_DEADLINE_QUEUE);
addGwQueue(queues, "gwParametersQueue", ParametersRequest.ROUTING_KEY, GW_PARAMETERS_QUEUE);
addGwQueue(queues, "gwUpdateParameterValueQueue", UpdateParameterValueRequest.ROUTING_KEY, GW_UPDATE_PARAMETER_VALUE_QUEUE);
addGwQueue(queues, "gwAdminParametersQueue", AdminParametersRequest.ROUTING_KEY, GW_ADMIN_PARAMETERS_QUEUE);
addGwQueue(queues, "gwGetPathQueue", GetPathRequest.ROUTING_KEY, GW_GET_PATH_QUEUE);
addGwQueue(queues, "gwFeatureFlagQueue", FeatureFlagRequest.ROUTING_KEY, GW_FEATURE_FLAG_QUEUE);
}
......
package ee.sm.ti.teis.adminservice.parameter;
import ee.sm.ti.teis.types.enums.DataType;
import ee.sm.ti.teis.types.enums.ScopeType;
import lombok.Getter;
import lombok.Setter;
import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.persistence.*;
import java.util.Set;
import static javax.persistence.EnumType.STRING;
import static javax.persistence.FetchType.EAGER;
@Entity
......@@ -26,14 +19,16 @@ public class ParameterEntity {
@Id
private String code;
private String name;
@NotNull
private String value;
private Boolean mandatory;
@Enumerated(STRING)
private DataType dataType;
private Boolean frequentlyChanged;
@ElementCollection(fetch = EAGER, targetClass = ScopeType.class)
@CollectionTable(name = "parameter_scope", joinColumns = @JoinColumn(name = "parameter_code"))
@Column(name = "scope")
@Enumerated(EnumType.STRING)
@Enumerated(STRING)
private Set<ScopeType> scopes;
}
package ee.sm.ti.teis.adminservice.parameter;
import ee.sm.ti.teis.commongateway.parameter.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.AdminParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.ParameterDto;
import ee.sm.ti.teis.domain.parameter.Parameter;
import org.mapstruct.Mapper;
import org.mapstruct.ReportingPolicy;
......@@ -15,4 +16,8 @@ public interface ParameterMapper {
Set<ParameterDto> toDtoList(Set<ParameterEntity> parameters);
List<Parameter> toDomainList(Set<ParameterEntity> parameters);
Set<AdminParameterDto> toAdminDtoList(Set<ParameterEntity> parameters);
AdminParameterDto toAdminDto(ParameterEntity parameter);
}
package ee.sm.ti.teis.adminservice.parameter.listener;
import ee.sm.ti.teis.adminservice.parameter.service.ParameterGwBusinessService;
import ee.sm.ti.teis.commongateway.parameter.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.ParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.ParametersResponse;
import ee.sm.ti.teis.commongateway.parameter.dto.AdminParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.UpdateParameterValueDto;
import ee.sm.ti.teis.commongateway.parameter.request.AdminParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.request.ParametersRequest;
import ee.sm.ti.teis.commongateway.parameter.request.UpdateParameterValueRequest;
import ee.sm.ti.teis.commongateway.parameter.response.AdminParametersResponse;
import ee.sm.ti.teis.commongateway.parameter.response.ParametersResponse;
import ee.sm.ti.teis.commongateway.parameter.response.UpdateParameterValueResponse;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
import java.util.Set;
import static ee.sm.ti.teis.adminservice.config.AdminQueueConfig.GW_PARAMETERS_QUEUE;
import static ee.sm.ti.teis.adminservice.config.AdminQueueConfig.*;
@Component
@RequiredArgsConstructor
......@@ -26,6 +33,31 @@ public class ParameterGwListener {
ParametersResponse response = new ParametersResponse();
response.setPayload(dtoSet, requestMetaDTO);
return response;
}
@RabbitListener(queues = {GW_ADMIN_PARAMETERS_QUEUE})
@PreAuthorize("@accessController.hasOfficialPrivilege({'TI_MANAGE_PARAMETERS'})")
public AdminParametersResponse getAdminParameters(AdminParametersRequest request) {
Set<AdminParameterDto> dtoSet = service.getAdminParameters();
AdminParametersResponse response = new AdminParametersResponse();
response.setPayload(dtoSet, request.getRequestMetaDTO());
return response;
}
@RabbitListener(queues = {GW_UPDATE_PARAMETER_VALUE_QUEUE})
@PreAuthorize("@accessController.hasOfficialPrivilege({'TI_MANAGE_PARAMETERS'})")
public UpdateParameterValueResponse updateParameterValue(UpdateParameterValueRequest request) {
RequestMetaDTO requestMetaDTO = request.getRequestMetaDTO();
UpdateParameterValueDto payload = request.getPayload();
AdminParameterDto dto = service.updateParameterValue(payload.getCode(), payload.getValue(), requestMetaDTO);
UpdateParameterValueResponse response = new UpdateParameterValueResponse();
response.setPayload(dto, requestMetaDTO);
return response;
}
}
......@@ -2,7 +2,8 @@ package ee.sm.ti.teis.adminservice.parameter.service;
import ee.sm.ti.teis.adminservice.parameter.ParameterEntity;
import ee.sm.ti.teis.adminservice.parameter.ParameterMapper;
import ee.sm.ti.teis.commongateway.parameter.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.AdminParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.ParameterDto;
import ee.sm.ti.teis.domain.parameter.Parameter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
......@@ -23,4 +24,12 @@ public class ParameterComposeService {
public List<Parameter> composeDomainList(Set<ParameterEntity> parameters) {
return mapper.toDomainList(parameters);
}
public Set<AdminParameterDto> composeAdminDtoList(Set<ParameterEntity> parameters) {
return mapper.toAdminDtoList(parameters);
}
public AdminParameterDto composeAdminDto(ParameterEntity parameter) {
return mapper.toAdminDto(parameter);
}
}
......@@ -2,6 +2,7 @@ package ee.sm.ti.teis.adminservice.parameter.service;
import ee.sm.ti.teis.adminservice.parameter.ParameterEntity;
import ee.sm.ti.teis.adminservice.parameter.ParameterRepository;
import ee.sm.ti.teis.exceptions.TeisResourceNotFoundException;
import ee.sm.ti.teis.types.enums.ScopeType;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
......@@ -18,7 +19,7 @@ import static java.util.stream.Collectors.toSet;
@RequiredArgsConstructor
public class ParameterDataService {
private static final Set<ScopeType> FILTERED_SCOPES = new HashSet<>(asList(OFFICE, COMMON, OPENDATA));
private static final Set<ScopeType> FILTERED_SCOPES = new HashSet<>(asList(OFFICE, COMMON, OPENDATA, PUBLIC));
private final ParameterRepository repository;
......@@ -29,10 +30,23 @@ public class ParameterDataService {
} else if (FILTERED_SCOPES.contains(scope)) {
return parameters.stream()
.filter(parameter -> parameter.getScopes().stream()
.anyMatch(s -> s.equals(scope)))
.anyMatch(s -> s.equals(scope) || s.equals(PUBLIC)))
.collect(toSet());
} else {
throw new IllegalStateException("Unexpected enum value: " + scope);
}
}
public Set<ParameterEntity> getParameters() {
return new HashSet<>(repository.findAll());
}
public ParameterEntity getByCode(String code) {
return repository.findById(code)
.orElseThrow(() -> new TeisResourceNotFoundException("Parameter not found by code", List.of(code)));
}
public void save(ParameterEntity parameter) {
repository.save(parameter);
}
}
package ee.sm.ti.teis.adminservice.parameter.service;
import ee.sm.ti.teis.adminservice.parameter.ParameterEntity;
import ee.sm.ti.teis.commongateway.parameter.ParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.AdminParameterDto;
import ee.sm.ti.teis.commongateway.parameter.dto.ParameterDto;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import ee.sm.ti.teis.types.enums.ScopeType;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Set;
import static ee.sm.ti.teis.adminservice.parameter.service.ParameterValidationService.validateUpdateParameterValue;
@Service
@Validated
@RequiredArgsConstructor
......@@ -17,9 +23,30 @@ public class ParameterGwBusinessService {
private final ParameterDataService dataService;
private final ParameterComposeService composeService;
private final ParameterNotifyService notifyService;
public Set<ParameterDto> getParameters(@NotNull ScopeType scope) {
Set<ParameterEntity> parameters = dataService.getParametersByScope(scope);
return composeService.composeDtoList(parameters);
}
public Set<AdminParameterDto> getAdminParameters() {
Set<ParameterEntity> parameters = dataService.getParameters();
return composeService.composeAdminDtoList(parameters);
}
@Transactional
public AdminParameterDto updateParameterValue(@NotBlank String code, String value, RequestMetaDTO requestMetaDTO) {