Commit af241f06 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/officials-service!52
parents 45b2257e 1aca8e4d
# Changelog
## [1.11.0] - 2021-06-14
* TEIS-2199: refactored Response classes from listeners to QueueConfig. new ms endpoint for getting official from sequence. new listener for testing getting officials from sequence
* TEIS-2185: added new tables: officials_sequence and official_in_sequence, and entities: OfficialInSequenceEntity and OfficialsSequenceEntity
* TEIS-1924: do not update modified_at value in fill_created_at_value function
## [1.10.0] - 2021-01-22
* generated created_at and modified_at values in existing records where values missing
......
theGroup=ee.sm.ti.teis
theVersion=1.10.1
commonsVersion=1.14.0
officeApiGatewayVersion=1.14.0
pluginVersion=1.2.0
theVersion=1.11.0
commonsVersion=1.26.0
officeApiGatewayVersion=1.26.0
pluginVersion=1.3.0
......@@ -3,9 +3,9 @@ package ee.sm.ti.teis.officials.office.listener;
import ee.sm.ti.teis.OfficialsAppTestBase;
import ee.sm.ti.teis.domain.officials.Office;
import ee.sm.ti.teis.officials.config.QueueConfig.OfficeDomainRequest;
import ee.sm.ti.teis.officials.config.QueueConfig.OfficeMsResponse;
import ee.sm.ti.teis.officials.config.QueueConfig.OfficesDomainRequest;
import ee.sm.ti.teis.officials.office.listener.OfficeMsListener.OfficeMsResponse;
import ee.sm.ti.teis.officials.office.listener.OfficeMsListener.OfficesMsResponse;
import ee.sm.ti.teis.officials.config.QueueConfig.OfficesMsResponse;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.assertj.core.api.Assertions;
import org.junit.jupiter.api.Test;
......
......@@ -47,7 +47,7 @@ class OfficialsMsListenerTest extends OfficialsAppTestBase {
String idCode = random.nextInt((92354 - 8945) + 1) + "";
OfficialUser newUser = OfficialUser.builder().firstName("First").lastName("Last").idCode(idCode).build();
OfficialMsListener.CreateOfficialUserMsResponse response = listener.create(composeCreateRequest(newUser));
CreateOfficialUserMsResponse response = listener.create(composeCreateRequest(newUser));
assertThat(response.getPayload().getIdCode()).isEqualTo(idCode);
assertThat(response.getPayload().getObjectStatus()).isEqualTo(ObjectStatus.CURRENT);
......@@ -56,14 +56,14 @@ class OfficialsMsListenerTest extends OfficialsAppTestBase {
@Test
void createOfficialUser_should_activate_existing_deleted_user() {
OfficialMsListener.OfficialUserMsResponse response = listener.getOfficialUser(composeOfficialUserRequest(DELETED_USER_ID));
OfficialUserMsResponse response = listener.getOfficialUser(composeOfficialUserRequest(DELETED_USER_ID));
assertThat(response.getPayload().getIdCode()).isEqualTo(DELETED_USER_ID_CODE);
assertThat(response.getPayload().getObjectStatus()).isEqualTo(ObjectStatus.DELETED);
OfficialUser newUser = OfficialUser.builder().firstName("First").lastName("Last").idCode(DELETED_USER_ID_CODE).build();
OfficialMsListener.CreateOfficialUserMsResponse userMsResponse = listener.create(composeCreateRequest(newUser));
CreateOfficialUserMsResponse userMsResponse = listener.create(composeCreateRequest(newUser));
assertThat(userMsResponse.getPayload().getId()).isEqualTo(UUID.fromString(DELETED_USER_ID));
assertThat(userMsResponse.getPayload().getObjectStatus()).isEqualTo(ObjectStatus.CURRENT);
......@@ -71,21 +71,21 @@ class OfficialsMsListenerTest extends OfficialsAppTestBase {
@Test
void findOfficialUser() {
OfficialMsListener.OfficialUserMsResponse response = listener.getOfficialUser(composeOfficialUserRequest(USER_ID));
OfficialUserMsResponse response = listener.getOfficialUser(composeOfficialUserRequest(USER_ID));
assertThat(response.getPayload().getId()).isEqualTo(UUID.fromString(USER_ID));
}
@Test
void findDeletedOfficialUser() {
OfficialMsListener.OfficialUserMsResponse response = listener.getOfficialUser(composeOfficialUserRequest(DELETED_USER_ID));
OfficialUserMsResponse response = listener.getOfficialUser(composeOfficialUserRequest(DELETED_USER_ID));
assertThat(response.getPayload().getId()).isEqualTo(UUID.fromString(DELETED_USER_ID));
}
@Test
void findOfficialUsers_by_idCode() {
OfficialMsListener.OfficialUsersMsResponse response = listener.getOfficialUsers(composeOfficialUsersRequest());
OfficialUsersMsResponse response = listener.getOfficialUsers(composeOfficialUsersRequest());
assertThat(response.getPayload()).isNotEmpty();
assertThat(response.getPayload().get(0).getIdCode()).isEqualTo(ACTIVE_USER_ID_CODE);
......@@ -93,7 +93,7 @@ class OfficialsMsListenerTest extends OfficialsAppTestBase {
@Test
void findOfficialUsers_ordered_by_firstName_and_lastName() {
OfficialMsListener.OfficialUsersMsResponse response = listener.getOfficialUsers(composeOfficialUsersByGroupIdRequest());
OfficialUsersMsResponse response = listener.getOfficialUsers(composeOfficialUsersByGroupIdRequest());
assertThat(response.getPayload()).isNotEmpty();
assertThat(response.getPayload().get(0).getId()).isEqualTo(UUID.fromString(ORDER_USER_FIRST_ID));
......@@ -107,14 +107,14 @@ class OfficialsMsListenerTest extends OfficialsAppTestBase {
UUID groupId = UUID.fromString("0503dab2-46c3-4d75-9b70-20296736bf3a");
// user exists before
OfficialMsListener.OfficialUserMsResponse officialUser = listener.getOfficialUser(composeOfficialUserRequest(userId.toString()));
OfficialUserMsResponse officialUser = listener.getOfficialUser(composeOfficialUserRequest(userId.toString()));
assertThat(officialUser.getPayload().getObjectStatus()).isEqualTo(ObjectStatus.CURRENT);
// user is group manager before
OfficialsGroupEntity groupBefore = repository.findById(groupId).orElse(new OfficialsGroupEntity());
assertThat(groupBefore.getOfficialsGroupManagerId()).isEqualTo(userId);
OfficialMsListener.DeleteOfficialUserMsResponse response = listener.delete(composeDeleteRequest(userId.toString()));
DeleteOfficialUserMsResponse response = listener.delete(composeDeleteRequest(userId.toString()));
// user is deleted
assertThat(response.getError()).isNull();
......
package ee.sm.ti.teis.officials.officialssequence;
import ee.sm.ti.teis.OfficialsAppTestBase;
import ee.sm.ti.teis.officegateway.official.dto.OfficialUserInSequenceDto;
import ee.sm.ti.teis.officegateway.official.request.GetOfficialFromSequenceTestRequest;
import ee.sm.ti.teis.officegateway.official.response.GetOfficialFromSequenceTestResponse;
import ee.sm.ti.teis.officials.officialssequence.listener.OfficialsSequenceGwTestListener;
import ee.sm.ti.teis.officials.officialssequence.service.OfficialsSequenceDataService;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.util.UUID;
import static org.assertj.core.api.Assertions.assertThat;
class OfficialsSequenceGwTestListenerTest extends OfficialsAppTestBase {
@Autowired
private OfficialsSequenceGwTestListener listener;
@Autowired
private OfficialsSequenceDataService dataService;
@Transactional
@Test
void getOfficialFromSequence_lastSelectedOfficialIdIsNotLastInSeq_success() {
UUID userTeineId = UUID.fromString("e0ee766d-4332-450a-9d9c-9835ae663d96");
GetOfficialFromSequenceTestRequest request = new GetOfficialFromSequenceTestRequest();
request.setPayload("testCodeLastSelectedOfficialIsNotLastInSeq", RequestMetaDTO.builder()
.requestId(UUID.randomUUID().toString())
.build());
GetOfficialFromSequenceTestResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getPayload()).isEqualTo(OfficialUserInSequenceDto.builder()
.officialUserId(userTeineId)
.firstName("Teine")
.lastName("Test-Kasutaja")
.build());
assertLastSelectedOfficialIsUpdated("testCodeLastSelectedOfficialIsNotLastInSeq", userTeineId);
}
private void assertLastSelectedOfficialIsUpdated(String code, UUID userId) {
OfficialsSequenceEntity sequence = dataService.getCurrentByCode(code);
assertThat(sequence.getLastSelectedOfficialId().equals(userId)).isTrue();
}
}
package ee.sm.ti.teis.officials.officialssequence;
import ee.sm.ti.teis.OfficialsAppTestBase;
import ee.sm.ti.teis.domain.officials.OfficialUserInSequence;
import ee.sm.ti.teis.domain.officials.OfficialsSequence;
import ee.sm.ti.teis.officials.config.QueueConfig.GetOfficialFromSequenceRequest;
import ee.sm.ti.teis.officials.config.QueueConfig.GetOfficialFromSequenceResponse;
import ee.sm.ti.teis.officials.officialssequence.listener.OfficialsSequenceMsListener;
import ee.sm.ti.teis.officials.officialssequence.service.OfficialsSequenceDataService;
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.UUID;
import static ee.sm.ti.teis.utils.TestUtils.assertBadRequest;
import static ee.sm.ti.teis.utils.TestUtils.assertResponseNotFound;
import static org.assertj.core.api.Assertions.assertThat;
class OfficialsSequenceMsListenerTest extends OfficialsAppTestBase {
private static final RequestMetaDTO REQUEST_META_DTO = RequestMetaDTO.builder()
.requestId(UUID.randomUUID().toString())
.build();
private static final UUID userEsimeneId = UUID.fromString("3dac227f-a8af-4771-8d8b-01409ac7fef0");
private static final UUID userTeineId = UUID.fromString("e0ee766d-4332-450a-9d9c-9835ae663d96");
private static final UUID userKolmasId = UUID.fromString("620437e0-3b57-48fc-bc40-5adcfd994638");
private static final UUID userMärtId = UUID.fromString("a61f6e93-6ba6-4b01-bd51-2a7b3f82d404");
private static final OfficialUserInSequence USER_ESIMENE = OfficialUserInSequence.builder()
.officialUserId(userEsimeneId)
.firstName("Esimene")
.lastName("Test-Kasutaja")
.build();
private static final OfficialUserInSequence USER_TEINE = OfficialUserInSequence.builder()
.officialUserId(userTeineId)
.firstName("Teine")
.lastName("Test-Kasutaja")
.build();
private static final OfficialUserInSequence USER_KOLMAS = OfficialUserInSequence.builder()
.officialUserId(userKolmasId)
.firstName("Kolmas")
.lastName("Test-Kasutaja")
.build();
private static final OfficialUserInSequence USER_MÄRT = OfficialUserInSequence.builder()
.officialUserId(userMärtId)
.firstName("Märt")
.lastName("Test-Lindpere")
.build();
GetOfficialFromSequenceRequest request;
OfficialsSequence payload;
@Autowired
private OfficialsSequenceMsListener listener;
@Autowired
private OfficialsSequenceDataService dataService;
@BeforeEach
void setUp() {
request = new GetOfficialFromSequenceRequest();
payload = new OfficialsSequence();
}
@Test
void getOfficialFromSequence_codeMissing_badRequest() {
payload.setCode(null);
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertBadRequest(response.getError());
}
@Test
void getOfficialFromSequence_nonExistentCode_notFound() {
payload.setCode("test");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertResponseNotFound(response.getError());
}
@Test
void getOfficialFromSequence_deletedCode_notFound() {
payload.setCode("testCodeDeletedSequence");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertResponseNotFound(response.getError());
}
@Test
void getOfficialFromSequence_noRelatedUsers_throwError() {
payload.setCode("testCodeNoRelatedOfficials");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getError().getCode()).isEqualTo(OfficialsSequenceErrorCode.OFFICIALS_SEQUENCE_1001.getCode());
assertThat(response.getError().getMessage()).isEqualTo("No official users found.");
}
@Test
void getOfficialFromSequence_noRelatedActiveUsers_throwError() {
payload.setCode("testCodeNoRelatedActiveOfficials");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getError().getCode()).isEqualTo(OfficialsSequenceErrorCode.OFFICIALS_SEQUENCE_1001.getCode());
assertThat(response.getError().getMessage()).isEqualTo("No official users found.");
}
@Transactional
@Test
void getOfficialFromSequence_lastSelectedOfficialIdIsNull_success() {
payload.setCode("testCodeLastSelectedOfficialIsNull");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getPayload()).isEqualTo(USER_ESIMENE);
assertLastSelectedOfficialIsUpdated("testCodeLastSelectedOfficialIsNull", userEsimeneId);
}
@Transactional
@Test
void getOfficialFromSequence_lastSelectedOfficialIdIsLastInSeq_success() {
payload.setCode("testCodeLastSelectedOfficialIsLastInSeq");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getPayload()).isEqualTo(USER_ESIMENE);
assertLastSelectedOfficialIsUpdated("testCodeLastSelectedOfficialIsLastInSeq", userEsimeneId);
}
@Transactional
@Test
void getOfficialFromSequence_lastSelectedOfficialIdIsNotLastInSeq_success() {
payload.setCode("testCodeLastSelectedOfficialIsNotLastInSeq");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getPayload()).isEqualTo(USER_TEINE);
assertLastSelectedOfficialIsUpdated("testCodeLastSelectedOfficialIsNotLastInSeq", userTeineId);
}
@Transactional
@Test
void getOfficialFromSequence_usersWithSameNames_success() {
payload.setCode("testCodeUsersWithSameName");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getPayload()).isEqualTo(USER_MÄRT);
assertLastSelectedOfficialIsUpdated("testCodeUsersWithSameName", userMärtId);
}
@Transactional
@Test
void getOfficialFromSequence_lastUserIdIsNotActive_returnNextActiveUser_success() {
payload.setCode("testCodeLastSelectedUserIsNotActiveReturnNextActiveUser");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getPayload()).isEqualTo(USER_KOLMAS);
assertLastSelectedOfficialIsUpdated("testCodeLastSelectedUserIsNotActiveReturnNextActiveUser", userKolmasId);
}
@Transactional
@Test
void getOfficialFromSequence_lastUserIdIsNotActive_returnFirstActiveUser_success() {
payload.setCode("testCodeLastSelectedUserIsNotActiveReturnFirstActiveUser");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getPayload()).isEqualTo(USER_ESIMENE);
assertLastSelectedOfficialIsUpdated("testCodeLastSelectedUserIsNotActiveReturnFirstActiveUser", userEsimeneId);
}
@Transactional
@Test
void getOfficialFromSequence_lastUserIdIsNotInThisSequence_returnFirstActiveUser_success() {
payload.setCode("testCodeLastSelectedUserIsNotInThisSequenceReturnFirstActiveUser");
request.setPayload(payload, REQUEST_META_DTO);
GetOfficialFromSequenceResponse response = listener.getOfficialFromSequenceAndUpdateSequenceLastSelectedOfficial(request);
assertThat(response.getPayload()).isEqualTo(USER_ESIMENE);
assertLastSelectedOfficialIsUpdated("testCodeLastSelectedUserIsNotInThisSequenceReturnFirstActiveUser", userEsimeneId);
}
private void assertLastSelectedOfficialIsUpdated(String code, UUID userId) {
OfficialsSequenceEntity sequence = dataService.getCurrentByCode(code);
assertThat(sequence.getLastSelectedOfficialId().equals(userId)).isTrue();
}
}
......@@ -6,15 +6,14 @@ import ee.sm.ti.teis.cache.officials.OfficialUserCacheUpdateService;
import ee.sm.ti.teis.cache.officials.OfficialsGroupCacheUpdateService;
import ee.sm.ti.teis.configuration.QueueList;
import ee.sm.ti.teis.configuration.TeisQueue;
import ee.sm.ti.teis.domain.officials.Office;
import ee.sm.ti.teis.domain.officials.OfficialUser;
import ee.sm.ti.teis.domain.officials.OfficialsGroup;
import ee.sm.ti.teis.domain.officials.*;
import ee.sm.ti.teis.domainrequest.*;
import ee.sm.ti.teis.officegateway.official.request.*;
import ee.sm.ti.teis.servicecommon.util.TestDataImportService;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.List;
@Configuration
public class QueueConfig implements QueueList {
......@@ -34,6 +33,7 @@ public class QueueConfig implements QueueList {
public static final String GW_OFFICES_QUEUE = "officials-service.gw.findOfficesRequest";
public static final String GW_ADD_OFFICIALS_GROUP_MEMBERS_QUEUE = "officials-service.gw.addGroupMembersRequest";
public static final String GW_DELETE_OFFICIALS_GROUP_MEMBER_QUEUE = "officials-service.gw.deleteGroupMemberRequest";
public static final String GW_GET_OFFICIAL_FROM_SEQUENCE_TEST_QUEUE = "officials-service.gw.getOfficialFromSequenceTestRequest";
public static final String MS_OFFICIAL_USER_QUEUE = "officials-service.ms.findUserRequest";
public static final String MS_OFFICIAL_USERS_QUEUE = "officials-service.ms.findUsersRequest";
......@@ -41,6 +41,7 @@ public class QueueConfig implements QueueList {
public static final String MS_UPDATE_OFFICIAL_USER_QUEUE = "officials-service.ms.updateUserRequest";
public static final String MS_OFFICIALS_GROUPS_QUEUE = "officials-service.ms.getOfficialGroup";
public static final String MS_DELETE_OFFICIAL_USER_QUEUE = "officials-service.ms.deleteUserRequest";
public static final String MS_GET_OFFICIAL_FROM_SEQUENCE_QUEUE = "officials-service.ms.getOfficialFromSequenceRequest";
public static final String CS_OFFICIAL_USERS_QUEUE = "officials-service.cs.officialUsersCacheRequests";
public static final String CS_OFFICIALS_GROUPS_QUEUE = "officials-service.cs.officialsGroupsCacheRequests";
......@@ -70,6 +71,7 @@ public class QueueConfig implements QueueList {
addGwQueue(queues, "gwFindOfficesQueue", OfficesRequest.ROUTING_KEY, GW_OFFICES_QUEUE);
addGwQueue(queues, "gwAddGroupMembersQueue", AddOfficialsGroupMembersRequest.ROUTING_KEY, GW_ADD_OFFICIALS_GROUP_MEMBERS_QUEUE);
addGwQueue(queues, "gwDeleteGroupMemberQueue", DeleteOfficialsGroupMemberRequest.ROUTING_KEY, GW_DELETE_OFFICIALS_GROUP_MEMBER_QUEUE);
addGwQueue(queues, "gwGetOfficialFromSequenceTestQueue", GetOfficialFromSequenceTestRequest.ROUTING_KEY, GW_GET_OFFICIAL_FROM_SEQUENCE_TEST_QUEUE);
addMsQueue(queues, "msFindUserQueue", new OfficialUserDomainRequest().routingKey(), MS_OFFICIAL_USER_QUEUE);
addMsQueue(queues, "msFindUsersQueue", new OfficialUsersDomainRequest().routingKey(), MS_OFFICIAL_USERS_QUEUE);
......@@ -79,6 +81,7 @@ public class QueueConfig implements QueueList {
addMsQueue(queues, "msDeleteUserQueue", new DeleteOfficialUserDomainRequest().routingKey(), MS_DELETE_OFFICIAL_USER_QUEUE);
addMsQueue(queues, "msFindOfficesQueue", new OfficesDomainRequest().routingKey(), MS_OFFICES_QUEUE);
addMsQueue(queues, "msFindOfficeQueue", new OfficeDomainRequest().routingKey(), MS_OFFICE_QUEUE);
addMsQueue(queues, "msGetOfficialFromSequenceQueue", new GetOfficialFromSequenceRequest().routingKey(), MS_GET_OFFICIAL_FROM_SEQUENCE_QUEUE);
addCsQueue(queues, "csOfficialUsersQueue",
new OfficialUserCacheUpdateService.OfficialUsersDomainCacheRequest().routingKey(),
......@@ -96,25 +99,55 @@ public class QueueConfig implements QueueList {
public static class OfficialUserDomainRequest extends DomainRequestDTO<OfficialUser, ErrorDTO> {
}
public static class OfficialUserMsResponse extends DomainResponseDTO<OfficialUser, ErrorDTO> {
}
public static class OfficialUsersDomainRequest extends DomainQueryDTO<OfficialUser, ErrorDTO> {
}
public static class OfficialUsersMsResponse extends DomainQueryResponseDto<List<OfficialUser>, ErrorDTO> {
}
public static class CreateOfficialUserDomainRequest extends DomainCreateDTO<OfficialUser, ErrorDTO> {
}
public static class CreateOfficialUserMsResponse extends DomainResponseDTO<OfficialUser, ErrorDTO> {
}
public static class UpdateOfficialUserDomainRequest extends DomainUpdateDTO<OfficialUser, ErrorDTO> {
}
public static class UpdateOfficialUserMsResponse extends DomainResponseDTO<OfficialUser, ErrorDTO> {
}
public static class OfficialUserGroupDomainRequest extends DomainRequestDTO<OfficialsGroup, ErrorDTO> {
}
public static class OfficialsGroupsDomainResponse extends DomainResponseDTO<OfficialsGroup, ErrorDTO> {
}
public static class DeleteOfficialUserDomainRequest extends DomainDeleteDTO<OfficialUser, ErrorDTO> {
}
public static class DeleteOfficialUserMsResponse extends DomainResponseDTO<OfficialUser, ErrorDTO> {
}
public static class OfficesDomainRequest extends DomainQueryDTO<Office, ErrorDTO> {
}
public static class OfficesMsResponse extends DomainQueryResponseDto<List<Office>, ErrorDTO> {
}
public static class OfficeDomainRequest extends DomainRequestDTO<Office, ErrorDTO> {
}
public static class OfficeMsResponse extends DomainResponseDTO<Office, ErrorDTO> {
}
public static class GetOfficialFromSequenceRequest extends DomainRequestDTO<OfficialsSequence, ErrorDTO> {
}
public static class GetOfficialFromSequenceResponse extends DomainResponseDTO<OfficialUserInSequence, ErrorDTO> {
}
}
package ee.sm.ti.teis.officials.group.listener;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.domain.officials.OfficialsGroup;
import ee.sm.ti.teis.domainrequest.DomainResponseDTO;
import ee.sm.ti.teis.officials.group.service.OfficialsGroupBusinessService;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import static ee.sm.ti.teis.officials.config.QueueConfig.MS_OFFICIALS_GROUPS_QUEUE;
import static ee.sm.ti.teis.officials.config.QueueConfig.OfficialUserGroupDomainRequest;
import static ee.sm.ti.teis.officials.config.QueueConfig.*;
@Component
@RequiredArgsConstructor
......@@ -27,6 +24,4 @@ public class OfficialsGroupMsListener {
return response;
}
public static class OfficialsGroupsDomainResponse extends DomainResponseDTO<OfficialsGroup, ErrorDTO> {
}
}
package ee.sm.ti.teis.officials.office.listener;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.domain.officials.Office;
import ee.sm.ti.teis.domainrequest.DomainQueryResponseDto;
import ee.sm.ti.teis.domainrequest.DomainResponseDTO;
import ee.sm.ti.teis.officials.config.QueueConfig.OfficeDomainRequest;
import ee.sm.ti.teis.officials.config.QueueConfig.OfficeMsResponse;
import ee.sm.ti.teis.officials.config.QueueConfig.OfficesDomainRequest;
import ee.sm.ti.teis.officials.config.QueueConfig.OfficesMsResponse;
import ee.sm.ti.teis.officials.office.OfficeEntity;
import ee.sm.ti.teis.officials.office.service.OfficeBusinessService;
import lombok.RequiredArgsConstructor;
......@@ -44,10 +43,4 @@ public class OfficeMsListener {
return response;
}
public static class OfficesMsResponse extends DomainQueryResponseDto<List<Office>, ErrorDTO> {
}
public static class OfficeMsResponse extends DomainResponseDTO<Office, ErrorDTO> {
}
}
package ee.sm.ti.teis.officials.official;
import ee.sm.ti.teis.domain.officials.OfficialUser;
import ee.sm.ti.teis.domain.officials.OfficialUserInSequence;
import ee.sm.ti.teis.officegateway.official.dto.OfficialUserDto;
import ee.sm.ti.teis.officegateway.official.dto.OfficialUserInSequenceDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.ReportingPolicy;
......@@ -20,4 +22,8 @@ public interface OfficialUserMapper {
@Mapping(target = "officialsGroupId", source = "officialsGroup.id")
OfficialUser toDomain(OfficialUserEntity entity);
@Mapping(target = "officialUserId", source = "id")
OfficialUserInSequence toOfficialUserInSequence(OfficialUser officialUser);
OfficialUserInSequenceDto toOfficialUserInSequenceDto(OfficialUserInSequence officialUserInSequence);
}
package ee.sm.ti.teis.officials.official.listener;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.tei