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

Merge branch 'develop' into TEIS-388-commonsi-tykeldamine

parents 658b419e 0398216f
......@@ -63,6 +63,13 @@ class OfficialsMsListenerTest extends OfficialsAppTestBase {
assertThat(response.getPayload().getId()).isEqualTo(UUID.fromString(USER_ID));
}
@Test
void findDeletedOfficialUser() {
OfficialMsListener.OfficialUserMsResponse response = officialListener.findOfficialUser(composeOfficialUserRequest(DELETED_USER_ID));
assertThat(response.getPayload().getId()).isEqualTo(UUID.fromString(DELETED_USER_ID));
}
@Test
void findOfficialUsers_by_idCode() {
OfficialMsListener.OfficialUsersMsResponse response = officialListener.findOfficialUsers(composeOfficialUsersRequest(ACTIVE_USER_IDCODE));
......
......@@ -10,10 +10,11 @@ import ee.sm.ti.teis.types.enums.ObjectStatus;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import static java.util.Optional.ofNullable;
@Component
public class OfficialsGroupMsListener {
private final OfficialsGroupService service;
public OfficialsGroupMsListener(OfficialsGroupService service) {
......@@ -21,9 +22,8 @@ public class OfficialsGroupMsListener {
}
@RabbitListener(queues = {QueueConfig.MS_OFFICIALS_GROUPS_QUEUE})
public OfficialsGroupsDomainResponse findOfficialsGroups(QueueConfig.OfficialUserGroupDomainRequest request) {
ObjectStatus status = service.validateAndAssignDefaultStatus(request.getPayload().getObjectStatus().name());
OfficialsGroupEntity entity = service.findGroupByIdAndStatus(request.getPayload().getId(), status);
public OfficialsGroupsDomainResponse findOfficialsGroup(QueueConfig.OfficialUserGroupDomainRequest request) {
OfficialsGroupEntity entity = service.findGroup(request.getPayload().getId());
OfficialsGroupsDomainResponse response = new OfficialsGroupsDomainResponse();
response.setPayload(service.composeDomainDtoFromEntity(entity), request.getRequestMetaDTO());
return response;
......
......@@ -13,7 +13,7 @@ VALUES
('751f8528-64a5-4e0e-862a-549356014861', 'Test Group', 'CURRENT', null),
('706bc212-ac68-4160-9c4b-7497a2de3430', 'Automaattestide Group', 'CURRENT', 'b429d838-758b-4ddd-b843-b6242675986f'),
('017b41a4-1871-4e00-9a36-cd27adbc1f5a', 'Valdkonnas pole managerit', 'CURRENT', null),
('c6bbd0d0-a614-408e-b22b-c60eed1a0dc9', 'Admin kasutajad (removed)', 'DELETED', null);
('c6bbd0d0-a614-408e-b22b-c60eed1a0dc9', 'Admin kasutajad (removed)', 'DELETED', '2d2aa827-d92a-4f77-af3c-a9537ba31d7b');
insert into official_user (id, id_code, first_name, last_name, officials_group_id, object_status)
VALUES
......@@ -23,7 +23,8 @@ VALUES
('b429d838-758b-4ddd-b843-b6242675986f', '38802170149', 'Neljas', 'Kasutaja', '706bc212-ac68-4160-9c4b-7497a2de3430', 'CURRENT'),
('b5d59f3b-57af-4971-8110-51019e5e827d', '49206111928', 'Admin', 'Kasutaja', '68b5b265-9427-457f-8f16-0bd5cf608714', 'CURRENT'),
('5d74e9ca-c0f4-40b5-85dd-6fbe5eb6a1a2', '47501020304', 'Kustutatud gruppi', 'Kasutaja', 'c6bbd0d0-a614-408e-b22b-c60eed1a0dc9', 'CURRENT'),
('2d2aa827-d92a-4f77-af3c-a9537ba31d7b', '48506111928', 'Kustutatud', 'Kasutaja', '751f8528-64a5-4e0e-862a-549356014861', 'DELETED'),
('2d2aa827-d92a-4f77-af3c-a9537ba31d7b', '48506111928', 'Kustutatud', 'Kasutaja', 'c6bbd0d0-a614-408e-b22b-c60eed1a0dc9', 'DELETED'),
('ebfffc90-72d0-4c0b-ab5e-1955e996fd28', '48506111922', 'Kustutatud Grupi', 'Kustutatud Manager', 'c6bbd0d0-a614-408e-b22b-c60eed1a0dc9', 'DELETED'),
('be01b415-86a5-4f4c-b1f2-2c065715b221', '48606111928', 'Kustutatud Teine', 'Kasutaja', 'ffb124d3-ce51-45e2-b8e5-343d11066998', 'DELETED'),
('06fe678a-90a8-49a7-8362-1041d244ef90', '60001018800', 'TeIS', 'Test1', 'ffb124d3-ce51-45e2-b8e5-343d11066998', 'CURRENT'),
('f0cafdc3-ff43-4c73-8319-93f07a7d5a3c', '50001018865', 'TeIS', 'Test2', 'ffb124d3-ce51-45e2-b8e5-343d11066998', 'CURRENT'),
......
Markdown is supported
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