Auth Tests

This commit is contained in:
Artemy
2025-06-19 09:51:55 +07:00
parent 7d518c0882
commit d18ad19f80
4 changed files with 91 additions and 3 deletions
+14 -1
View File
@@ -1,3 +1,16 @@
using System.ComponentModel.DataAnnotations;
using Govor.Core.Infrastructure.Validators;
namespace Govor.Core.DTOs;
public record UserDto(string Password, string Name);
public record UserDto
{
[Required]
[StringLength(UserValidator.MAX_LENGHT_OF_NAME,
MinimumLength = UserValidator.MIN_LENGHT_OF_NAME,
ErrorMessage = "Username must be between 4 and 50 characters.")]
public string Name { get; init; }
[Required]
[MinLength(8)]
public string Password { get; init; }
}
@@ -6,7 +6,7 @@ namespace Govor.Core.Infrastructure.Validators;
public class UserValidator : IObjectValidator<User>
{
public const int MIN_LENGHT_OF_NAME = 4;
public const int MAX_LENGHT_OF_NAME = 100;
public const int MAX_LENGHT_OF_NAME = 50;
public void Validate(User user)
{