Merge pull request 'main' (#32) from main into feature-nxdev

Reviewed-on: #32
This commit is contained in:
2025-12-29 21:57:33 +08:00
committed by nanxun
16 changed files with 780 additions and 268 deletions
+26 -2
View File
@@ -1,7 +1,31 @@
using IM_API.Models;
using System.ComponentModel.DataAnnotations;
namespace IM_API.Dtos
{
public record FriendInfoDto(int Id, int UserId,int FriendId,FriendStatus StatusEnum,DateTime Created,string RemarkName,string? Avatar);
public record FriendRequestHandleDto(HandleFriendRequestAction action,string? remarkName);
public record FriendInfoDto
{
public int Id { get; init; }
public int UserId { get; init; }
public int FriendId { get; init; }
public FriendStatus StatusEnum { get; init; }
public DateTime Created { get; init; }
public string RemarkName { get; init; } = string.Empty;
public string? Avatar { get; init; }
}
public record FriendRequestHandleDto
{
[Required(ErrorMessage = "操作必填")]
public HandleFriendRequestAction Action { get; init; }
[StringLength(20, ErrorMessage = "备注名最大20个字符")]
public string? RemarkName { get; init; }
}
}
+6 -1
View File
@@ -1,10 +1,15 @@
namespace IM_API.Dtos
using System.ComponentModel.DataAnnotations;
namespace IM_API.Dtos
{
public class FriendRequestDto
{
public int FromUserId { get; set; }
public int ToUserId { get; set; }
[Required(ErrorMessage = "备注名必填")]
[StringLength(20, ErrorMessage = "备注名不能超过20位字符")]
public string? RemarkName { get; set; }
[StringLength(50, ErrorMessage = "描述不能超过50字符")]
public string? Description { get; set; }
}
}
+10 -1
View File
@@ -1,8 +1,17 @@
namespace IM_API.Dtos
using IM_API.Tools;
using System.ComponentModel.DataAnnotations;
namespace IM_API.Dtos
{
public class LoginRequestDto
{
[Required(ErrorMessage = "用户名不能为空")]
[StringLength(20, ErrorMessage = "用户名不能超过20字符")]
[RegularExpression(@"^[A-Za-z0-9]+$",ErrorMessage = "")]
public string Username { get; set; }
[Required(ErrorMessage = "密码不能为空")]
[StringLength(50, ErrorMessage = "密码不能超过50字符")]
public string Password { get; set; }
}
}
+11 -1
View File
@@ -1,9 +1,19 @@
namespace IM_API.Dtos
using System.ComponentModel.DataAnnotations;
namespace IM_API.Dtos
{
public class RegisterRequestDto
{
[Required(ErrorMessage = "用户名不能为空")]
[MaxLength(20, ErrorMessage = "用户名不能超过20字符")]
[RegularExpression(@"^[A-Za-z0-9]+$", ErrorMessage = "")]
public string Username { get; set; }
[Required(ErrorMessage = "密码不能为空")]
[MaxLength(50, ErrorMessage = "密码不能超过50字符")]
public string Password { get; set; }
[Required(ErrorMessage = "昵称不能为空")]
[MaxLength(20, ErrorMessage = "昵称不能超过20字符")]
public string? NickName { get; set; }
}
}
+4 -1
View File
@@ -1,7 +1,10 @@
namespace IM_API.Dtos
using System.ComponentModel.DataAnnotations;
namespace IM_API.Dtos
{
public class UpdateUserDto
{
[MaxLength(20, ErrorMessage = "昵称不能超过50字符")]
public string? NickName { get; set; }
public string? Avatar { get; set; }
+16 -2
View File
@@ -1,7 +1,21 @@
using IM_API.Models;
using System.ComponentModel.DataAnnotations;
namespace IM_API.Dtos
{
public record PasswordResetDto(string oldPassword,string Password);
public record OnlineStatusSetDto(UserOnlineStatus OnlineStatus);
public record PasswordResetDto
{
[Required(ErrorMessage = "旧密码不能为空")]
public string OldPassword { get; init; }
[Required(ErrorMessage = "新密码不能为空")]
[MaxLength(50, ErrorMessage = "密码不能超过50个字符")]
public string Password { get; init; }
}
public record OnlineStatusSetDto
{
[Required]
public UserOnlineStatus OnlineStatus { get; init; }
}
}