-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathUserDto.java
More file actions
53 lines (45 loc) · 1.62 KB
/
Copy pathUserDto.java
File metadata and controls
53 lines (45 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.digitalsanctuary.spring.user.dto;
import com.digitalsanctuary.spring.user.validation.PasswordMatches;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.ToString;
/**
* Data Transfer Object for user registration and related form data.
* <p>
* Used for handling user registration forms and related operations. Contains user details
* including name, email, password with confirmation, and optional role assignment.
* Validated using {@link PasswordMatches} to ensure password confirmation matches.
* </p>
*
* @author Devon Hillard
*/
@Data
@PasswordMatches
public class UserDto {
/** The first name. */
@NotBlank(message = "First name is required")
@Size(max = 50, message = "First name must not exceed 50 characters")
private String firstName;
/** The last name. */
@NotBlank(message = "Last name is required")
@Size(max = 50, message = "Last name must not exceed 50 characters")
private String lastName;
/** The password. */
@ToString.Exclude
@NotBlank(message = "Password is required")
@Size(min = 8, max = 128, message = "Password must be between 8 and 128 characters")
private String password;
/** The matching password. */
@ToString.Exclude
@NotBlank(message = "Password confirmation is required")
private String matchingPassword;
/** The email. */
@NotBlank(message = "Email is required")
@Email(message = "Please provide a valid email address")
@Size(max = 100, message = "Email must not exceed 100 characters")
private String email;
/** The role. */
private Integer role;
}