Commit 513b8c38 authored by Jyrgen Hannus's avatar Jyrgen Hannus
Browse files

technical-debt: refactored code

parent 07c4c028
......@@ -4,7 +4,6 @@ import ee.sm.ti.teis.officegateway.official.dto.OfficialUserDto;
import ee.sm.ti.teis.officegateway.official.request.*;
import ee.sm.ti.teis.officegateway.official.request.OfficialUsersRequest.Parameters;
import ee.sm.ti.teis.officegateway.official.response.*;
import ee.sm.ti.teis.officials.config.QueueConfig;
import ee.sm.ti.teis.officials.official.service.OfficialBusinessService;
import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
......@@ -13,6 +12,8 @@ import org.springframework.stereotype.Component;
import java.util.List;
import static ee.sm.ti.teis.officials.config.QueueConfig.*;
@Component
@PreAuthorize("@accessController.isOfficialUser()")
@RequiredArgsConstructor
......@@ -20,7 +21,7 @@ public class OfficialGwListener {
private final OfficialBusinessService service;
@RabbitListener(queues = {QueueConfig.GW_CREATE_OFFICIAL_USER_QUEUE})
@RabbitListener(queues = {GW_CREATE_OFFICIAL_USER_QUEUE})
public CreateOfficialUserResponse create(CreateOfficialUserRequest request) {
OfficialUserDto dto = service.create(request.getPayload().getOfficialUser(), request.getRequestMetaDTO());
......@@ -30,7 +31,7 @@ public class OfficialGwListener {
return response;
}
@RabbitListener(queues = {QueueConfig.GW_OFFICIAL_USER_QUEUE})
@RabbitListener(queues = {GW_OFFICIAL_USER_QUEUE})
public OfficialUserResponse getOfficialUser(OfficialUserRequest request) {
OfficialUserDto dto = service.getOfficialUser(request.getPayload());
......@@ -40,7 +41,7 @@ public class OfficialGwListener {
return response;
}
@RabbitListener(queues = {QueueConfig.GW_OFFICIAL_USERS_QUEUE})
@RabbitListener(queues = {GW_OFFICIAL_USERS_QUEUE})
public OfficialUsersResponse getOfficialUsers(OfficialUsersRequest request) {
Parameters payload = request.getPayload();
List<OfficialUserDto> dtoList = service.getOfficialUsers(payload.getIdCode(), payload.getGroupId(), payload.getObjectStatus());
......@@ -51,7 +52,7 @@ public class OfficialGwListener {
return response;
}
@RabbitListener(queues = {QueueConfig.GW_DELETE_OFFICIAL_USER_QUEUE})
@RabbitListener(queues = {GW_DELETE_OFFICIAL_USER_QUEUE})
@PreAuthorize("@accessController.hasOfficialPrivilege({T(ee.sm.ti.teis.types.enums.RolePrivilegeCode).TI_MANAGE_OFFICIALS})")
public DeleteOfficialUserResponse delete(DeleteOfficialUserRequest request) {
service.delete(request.getPayload(), request.getRequestMetaDTO());
......@@ -62,7 +63,7 @@ public class OfficialGwListener {
return response;
}
@RabbitListener(queues = {QueueConfig.GW_UPDATE_OFFICIAL_USER_QUEUE})
@RabbitListener(queues = {GW_UPDATE_OFFICIAL_USER_QUEUE})
@PreAuthorize("@accessController.hasOfficialPrivilege({T(ee.sm.ti.teis.types.enums.RolePrivilegeCode).TI_MANAGE_OFFICIALS})")
public UpdateOfficialUserResponse update(UpdateOfficialUserRequest request) {
OfficialUserDto officialUser = request.getPayload().getOfficialUser();
......
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