fronted: login

This commit is contained in:
2025-08-15 20:03:07 +02:00
parent f61b48fa4b
commit 1b2d95344a
184 changed files with 5238 additions and 232 deletions

View File

@@ -10,6 +10,9 @@ public class UserModel : PersonModel
public string Email { get; set; }
[Required, MinLength(8)]
public string Password { get; set; }
[Required]
public string Salt { get; set; }
[ForeignKey("RoleId")]
public List<RoleModel> Role { get; set; }
public UserModel(string id, string email, string password, string name, List<RoleModel> role, DateTime createdAt, DateTime updatedAt)
@@ -22,17 +25,30 @@ public class UserModel : PersonModel
UpdatedAt = updatedAt;
}
public UserModel() { }
public bool IsAdmin => Role.Exists(r => r.IsAdmin);
public bool IsContentManager => Role.Exists(r => r.IsContentManager);
public bool IsUser => Role.Exists(r => r.IsUser);
public static readonly UserModel DefaultUser = new(
"0",
"default@example.com",
string.Empty,
"Default User",
[RoleModel.UserRole],
DateTime.UtcNow,
DateTime.UtcNow
);
public UserDto ToDto()
{
return new UserDto
{
Id = Id,
Name = Name,
Email = Email,
ProfilePicture = ProfilePicture,
Avatar = Avatar,
SocialMedia = SocialMedia,
Bio = Bio,
CreatedAt = CreatedAt,
UpdatedAt = UpdatedAt
};
}
}
public class UserDto : PersonModel
{
public required string Email { get; set; }
}