SUPPORT-8957: add dtos
This commit is contained in:
parent
e5c7e003a0
commit
b3deb8704b
15 changed files with 198 additions and 0 deletions
|
|
@ -0,0 +1,15 @@
|
|||
package ru.micord.ervu.account_applications.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record Account(String schema, @JsonProperty("user-domain") String userDomain,
|
||||
String position, boolean enabled, boolean esiaAccount,
|
||||
String start, String finish) {
|
||||
|
||||
public Account(String userDomain, String position) {
|
||||
this("Account", userDomain, position, true, false, "", "");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package ru.micord.ervu.account_applications.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record Person(String id, String surname, String firstname, String middlename, String sex,
|
||||
String email, String birthdate, String snils, List<String> ipAddresses,
|
||||
boolean secondFactorEnabled) {
|
||||
|
||||
public Person(String surname, String firstname, String middlename, String sex, String email,
|
||||
String birthdate, String snils, List<String> ipAddresses) {
|
||||
this("", surname, firstname, middlename, sex, email, birthdate, snils, ipAddresses);
|
||||
}
|
||||
|
||||
public Person(String id, String surname, String firstname, String middlename, String sex,
|
||||
String email, String birthdate, String snils, List<String> ipAddresses) {
|
||||
this(id, surname, firstname, middlename, sex, email, birthdate, snils, ipAddresses, false);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package ru.micord.ervu.account_applications.dto;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public abstract class ProcessRequest<T> {
|
||||
|
||||
protected final String processKey;
|
||||
protected final String userId;
|
||||
protected final T data;
|
||||
|
||||
public ProcessRequest(String processKey, String userId, T data) {
|
||||
this.processKey = processKey;
|
||||
this.userId = userId;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public String getProcessKey() {
|
||||
return processKey;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package ru.micord.ervu.account_applications.dto;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record ProcessResponse(String code, String msg, String traceId) {
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package ru.micord.ervu.account_applications.dto;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record Role(String id, String finish) {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package ru.micord.ervu.account_applications.dto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record Roles(List<Role> rolesList) {
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
package ru.micord.ervu.account_applications.dto.create;
|
||||
|
||||
import ru.micord.ervu.account_applications.dto.Account;
|
||||
import ru.micord.ervu.account_applications.dto.Person;
|
||||
import ru.micord.ervu.account_applications.dto.Roles;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record CreateData(Credential credential, Account account, Person person, Roles roles) {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.micord.ervu.account_applications.dto.create;
|
||||
|
||||
import ru.micord.ervu.account_applications.dto.ProcessRequest;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public class CreateProcessRequest extends ProcessRequest<CreateData> {
|
||||
|
||||
public CreateProcessRequest(String processKey, String userId, CreateData data) {
|
||||
super(processKey, userId, data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package ru.micord.ervu.account_applications.dto.create;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record CreateUserDto(@NotNull String firstname, @NotNull String surname, String middlename,
|
||||
String birthdate, String sex, String position, String email,
|
||||
@NotNull String username, @NotNull String snils,
|
||||
@NotNull @NotEmpty String userDomain,
|
||||
String start, String finish,
|
||||
List<String> roles, List<String> ipAddresses) {
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
package ru.micord.ervu.account_applications.dto.create;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record Credential(String userName) {
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package ru.micord.ervu.account_applications.dto.deactivate;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record DeactivateData(List<String> accountIdList) {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.micord.ervu.account_applications.dto.deactivate;
|
||||
|
||||
import ru.micord.ervu.account_applications.dto.ProcessRequest;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public class DeactivateProcessRequest extends ProcessRequest<DeactivateData> {
|
||||
|
||||
public DeactivateProcessRequest(String processKey, String userId, DeactivateData data) {
|
||||
super(processKey, userId, data);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package ru.micord.ervu.account_applications.dto.edit;
|
||||
|
||||
import ru.micord.ervu.account_applications.dto.Person;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public record EditData(String accountId, Person personData) {
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package ru.micord.ervu.account_applications.dto.edit;
|
||||
|
||||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public record EditPersonDto(@NotNull String accountId, @NotNull String id,
|
||||
@NotNull String firstname, @NotNull String surname, String middlename,
|
||||
String birthdate, String sex, String position, String email,
|
||||
@NotNull String snils, List<String> ipAddresses) {
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package ru.micord.ervu.account_applications.dto.edit;
|
||||
|
||||
import ru.micord.ervu.account_applications.dto.ProcessRequest;
|
||||
|
||||
/**
|
||||
* @author gulnaz
|
||||
*/
|
||||
public class EditPersonProcessRequest extends ProcessRequest<EditData> {
|
||||
|
||||
public EditPersonProcessRequest(String processKey, String userId, EditData data) {
|
||||
super(processKey, userId, data);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue