Commit 87fb433e 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/common-api-gateway!91
parents 412679ea 98a2f201
package ee.sm.ti.teis.commongateway.admin;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.*;
import java.time.LocalDate;
......@@ -16,6 +12,7 @@ import java.time.LocalDate;
public class GetDeadlineDto {
private LocalDate startDate;
private int numberOfDays;
private boolean onlyWorkDay;
private Integer numberOfDays;
private Boolean onlyWorkDay;
private Integer numberOfYears;
}
......@@ -22,10 +22,10 @@ public class IndividualPersonDto implements SensitiveType {
@Size(max = 25)
private String idCode;
@NotBlank
@Size(max = 500)
@Size(min = 1, max = 500)
private String firstName;
@NotBlank
@Size(max = 500)
@Size(min = 1, max = 500)
private String lastName;
private LocalDate dateOfBirth;
private Boolean unidentified;
......
......@@ -7,6 +7,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
@Data
......@@ -17,6 +18,7 @@ public class LegalPersonDto implements Serializable {
@NotBlank
private String regCode;
@NotBlank
@Size(min = 1, max = 500)
private String name;
private String countryId;
private ClassifierItemLightDto country;
......
package ee.sm.ti.teis.commongateway.proceedings.proceeding.dto;
import ee.sm.ti.teis.types.enums.PermissionActivityType;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class MessagePermissionDto {
private PermissionActivityType activity;
private boolean hasPermission;
}
package ee.sm.ti.teis.commongateway.proceedings.proceeding.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
public class MessagePermissionRequest extends AbstractDTO<String, ErrorDTO> {
public static final String ROUTING_KEY = "api.MessagePermissionRequest";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.proceedings.proceeding;
package ee.sm.ti.teis.commongateway.proceedings.proceeding.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.proceedings.proceeding;
package ee.sm.ti.teis.commongateway.proceedings.proceeding.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.proceedings.proceeding;
package ee.sm.ti.teis.commongateway.proceedings.proceeding.request;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.proceedings.proceeding.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
import ee.sm.ti.teis.commongateway.proceedings.proceeding.dto.MessagePermissionDto;
import java.util.List;
public class MessagePermissionResponse extends AbstractDTO<List<MessagePermissionDto>, ErrorDTO> {
public static final String ROUTING_KEY = "api.MessagePermissionResponse";
@Override
public String routingKey() {
return ROUTING_KEY;
}
}
package ee.sm.ti.teis.commongateway.proceedings.proceeding;
package ee.sm.ti.teis.commongateway.proceedings.proceeding.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.proceedings.proceeding;
package ee.sm.ti.teis.commongateway.proceedings.proceeding.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
......
package ee.sm.ti.teis.commongateway.proceedings.proceeding;
package ee.sm.ti.teis.commongateway.proceedings.proceeding.response;
import ee.sm.ti.teis.AbstractDTO;
import ee.sm.ti.teis.ErrorDTO;
......
......@@ -26,7 +26,9 @@ public class ViolationActPublicDto {
private ClassifierItemLightDto type;
private OfficialUserPublicDto officialUser;
private ClassifierItemLightDto status;
private ObjectStatus objectStatus;
private ClassifierItemLightDto accessRestriction;
private LocalDate accessRestrictionStartDate;
private LocalDate accessRestrictionEndDate;
private List<ClassifierItemLightDto> violationActLegislations;
private PreceptPublicDto precept;
private WarningOfPenaltyPaymentPublicDto warningOfPenaltyPayment;
......@@ -34,4 +36,5 @@ public class ViolationActPublicDto {
private ViolationPublicDto violation;
private ViolationEliminationDeadlinePublicDto violationEliminationDeadline;
private FileReferenceDto file;
private ObjectStatus objectStatus;
}
......@@ -38,6 +38,7 @@ public class RepresentativeDto implements SensitiveType {
private LocalDate validUntil;
private String email;
private String phone;
private Boolean isEmployee;
private ObjectStatus objectStatus;
......
package ee.sm.ti.teis.commongateway.proceedings.proceeding;
import ee.sm.ti.teis.commongateway.CommonApiGatewayTestBase;
import ee.sm.ti.teis.gatewaycommon.error.NoResponseFromRabbitException;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static org.junit.jupiter.api.Assertions.assertThrows;
public class ProceedingControllerTest extends CommonApiGatewayTestBase {
@Autowired
ProceedingController controller;
@Test
void getProceedings_throwsException() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getProceedings(
"", new RequestMetaDTO()));
}
@Test
void getProceeding_throwsException() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getProceeding(
"", new RequestMetaDTO()));
}
@Test
void getMessagePermission_throwsException() {
assertThrows(NoResponseFromRabbitException.class, () -> controller.getMessagePermission(
"", new RequestMetaDTO()));
}
}
......@@ -35,6 +35,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.and()
.headers().frameOptions().disable()
.and()
.headers().xssProtection().disable()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
......
......@@ -62,8 +62,6 @@ public class PersonProcessingService {
UpdatePersonRequest updatePersonRequest = new UpdatePersonRequest();
updatePersonRequest.setPayload(new UpdatePersonRequest.Parameters(person), requestMetaDTO);
updatePerson(updatePersonRequest);
// FIXME: update asynchronously
// gwRabbitTemplate.convertAndSend(updatePersonRequest.routingKey(), updatePersonRequest);
}
PersonDto getLegalPerson(GetOrCreatePersonRequest requestDTO) {
......
package ee.sm.ti.teis.commongateway.proceedings.proceeding;
import ee.sm.ti.teis.commongateway.proceedings.proceeding.dto.MessagePermissionDto;
import ee.sm.ti.teis.commongateway.proceedings.proceeding.dto.ProceedingPublicDto;
import ee.sm.ti.teis.commongateway.proceedings.proceeding.request.MessagePermissionRequest;
import ee.sm.ti.teis.commongateway.proceedings.proceeding.request.ProceedingPublicRequest;
import ee.sm.ti.teis.commongateway.proceedings.proceeding.request.ProceedingsPublicRequest;
import ee.sm.ti.teis.gatewaycommon.controller.TeisBaseController;
import ee.sm.ti.teis.servicerequest.RequestMetaDTO;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
......@@ -54,4 +50,18 @@ public class ProceedingController extends TeisBaseController {
return processingService.getProceedings(request);
}
@ApiOperation(value = "${teis.api.messages.proceeding.get-message-permissions}", response = MessagePermissionDto.class)
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Sisendi parameetrid ei vasta nõuetele"),
@ApiResponse(code = 403, message = "Kasutajal ei ole õigust andmeobjekti pärida"),
@ApiResponse(code = 404, message = "Sisendis esitatud andmetega objekti ei eksisteeri")})
@ApiImplicitParams(@ApiImplicitParam(name = "id", value = "${teis.api.messages.proceeding.get-proceeding-id}"))
@GetMapping(value = "{id}/message-permissions")
public List<MessagePermissionDto> getMessagePermission(@PathVariable String id, @ApiIgnore RequestMetaDTO requestMetaDTO) {
MessagePermissionRequest request = new MessagePermissionRequest();
request.setPayload(id, requestMetaDTO);
return processingService.getMessagePermission(request);
}
}
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