Add user account management methods and update user-related mappers
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package com.gameplatform.server.model.dto.account;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
public class AccountCreateRequest {
|
||||
@NotBlank
|
||||
private String userType; // ADMIN | AGENT
|
||||
@NotBlank
|
||||
@Size(min = 3, max = 64)
|
||||
private String username;
|
||||
@Size(max = 100)
|
||||
private String displayName;
|
||||
private String role; // for ADMIN: SUPER | ADMIN
|
||||
private String status = "ENABLED"; // ENABLED | DISABLED
|
||||
@NotBlank
|
||||
@Size(min = 6, max = 128)
|
||||
private String initialPassword;
|
||||
@Min(0)
|
||||
private Long pointsBalance = 0L; // for AGENT
|
||||
|
||||
public String getUserType() { return userType; }
|
||||
public void setUserType(String userType) { this.userType = userType; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getDisplayName() { return displayName; }
|
||||
public void setDisplayName(String displayName) { this.displayName = displayName; }
|
||||
public String getRole() { return role; }
|
||||
public void setRole(String role) { this.role = role; }
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public String getInitialPassword() { return initialPassword; }
|
||||
public void setInitialPassword(String initialPassword) { this.initialPassword = initialPassword; }
|
||||
public Long getPointsBalance() { return pointsBalance; }
|
||||
public void setPointsBalance(Long pointsBalance) { this.pointsBalance = pointsBalance; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.gameplatform.server.model.dto.account;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class AccountResponse {
|
||||
private Long id;
|
||||
private String userType;
|
||||
private String username;
|
||||
private String displayName;
|
||||
private String role;
|
||||
private String status;
|
||||
private Long pointsBalance;
|
||||
private LocalDateTime createdAt;
|
||||
private LocalDateTime updatedAt;
|
||||
|
||||
public Long getId() { return id; }
|
||||
public void setId(Long id) { this.id = id; }
|
||||
public String getUserType() { return userType; }
|
||||
public void setUserType(String userType) { this.userType = userType; }
|
||||
public String getUsername() { return username; }
|
||||
public void setUsername(String username) { this.username = username; }
|
||||
public String getDisplayName() { return displayName; }
|
||||
public void setDisplayName(String displayName) { this.displayName = displayName; }
|
||||
public String getRole() { return role; }
|
||||
public void setRole(String role) { this.role = role; }
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
public Long getPointsBalance() { return pointsBalance; }
|
||||
public void setPointsBalance(Long pointsBalance) { this.pointsBalance = pointsBalance; }
|
||||
public LocalDateTime getCreatedAt() { return createdAt; }
|
||||
public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
|
||||
public LocalDateTime getUpdatedAt() { return updatedAt; }
|
||||
public void setUpdatedAt(LocalDateTime updatedAt) { this.updatedAt = updatedAt; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.gameplatform.server.model.dto.account;
|
||||
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public class AccountUpdateRequest {
|
||||
@Size(max = 100)
|
||||
private String displayName;
|
||||
private String role; // SUPER | ADMIN (only for ADMIN)
|
||||
private String status; // ENABLED | DISABLED
|
||||
|
||||
public String getDisplayName() { return displayName; }
|
||||
public void setDisplayName(String displayName) { this.displayName = displayName; }
|
||||
public String getRole() { return role; }
|
||||
public void setRole(String role) { this.role = role; }
|
||||
public String getStatus() { return status; }
|
||||
public void setStatus(String status) { this.status = status; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.gameplatform.server.model.dto.account;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Size;
|
||||
|
||||
public class ResetPasswordRequest {
|
||||
@NotBlank
|
||||
@Size(min = 6, max = 128)
|
||||
private String newPassword;
|
||||
private Boolean forceLogout = Boolean.TRUE;
|
||||
|
||||
public String getNewPassword() { return newPassword; }
|
||||
public void setNewPassword(String newPassword) { this.newPassword = newPassword; }
|
||||
public Boolean getForceLogout() { return forceLogout; }
|
||||
public void setForceLogout(Boolean forceLogout) { this.forceLogout = forceLogout; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.gameplatform.server.model.dto.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PageResult<T> {
|
||||
private List<T> items;
|
||||
private long total;
|
||||
private int page;
|
||||
private int size;
|
||||
|
||||
public PageResult() {}
|
||||
|
||||
public PageResult(List<T> items, long total, int page, int size) {
|
||||
this.items = items;
|
||||
this.total = total;
|
||||
this.page = page;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public List<T> getItems() { return items; }
|
||||
public void setItems(List<T> items) { this.items = items; }
|
||||
public long getTotal() { return total; }
|
||||
public void setTotal(long total) { this.total = total; }
|
||||
public int getPage() { return page; }
|
||||
public void setPage(int page) { this.page = page; }
|
||||
public int getSize() { return size; }
|
||||
public void setSize(int size) { this.size = size; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user