feat(udt-001): domain layer with Usuario entity
This commit is contained in:
36
src/api/SIGCM2.Domain/Entities/Usuario.cs
Normal file
36
src/api/SIGCM2.Domain/Entities/Usuario.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
namespace SIGCM2.Domain.Entities;
|
||||||
|
|
||||||
|
public sealed class Usuario
|
||||||
|
{
|
||||||
|
public int Id { get; }
|
||||||
|
public string Username { get; }
|
||||||
|
public string PasswordHash { get; }
|
||||||
|
public string Nombre { get; }
|
||||||
|
public string Apellido { get; }
|
||||||
|
public string? Email { get; }
|
||||||
|
public string Rol { get; }
|
||||||
|
public string PermisosJson { get; }
|
||||||
|
public bool Activo { get; }
|
||||||
|
|
||||||
|
public Usuario(
|
||||||
|
int id,
|
||||||
|
string username,
|
||||||
|
string passwordHash,
|
||||||
|
string nombre,
|
||||||
|
string apellido,
|
||||||
|
string? email,
|
||||||
|
string rol,
|
||||||
|
string permisosJson,
|
||||||
|
bool activo)
|
||||||
|
{
|
||||||
|
Id = id;
|
||||||
|
Username = username;
|
||||||
|
PasswordHash = passwordHash;
|
||||||
|
Nombre = nombre;
|
||||||
|
Apellido = apellido;
|
||||||
|
Email = email;
|
||||||
|
Rol = rol;
|
||||||
|
PermisosJson = permisosJson;
|
||||||
|
Activo = activo;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
namespace SIGCM2.Domain.Exceptions;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Thrown when login credentials are invalid (user not found, wrong password, or inactive).
|
||||||
|
/// Deliberately vague to prevent user enumeration.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class InvalidCredentialsException : Exception
|
||||||
|
{
|
||||||
|
public InvalidCredentialsException()
|
||||||
|
: base("Credenciales inválidas") { }
|
||||||
|
}
|
||||||
10
src/api/SIGCM2.Domain/SIGCM2.Domain.csproj
Normal file
10
src/api/SIGCM2.Domain/SIGCM2.Domain.csproj
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net10.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<RootNamespace>SIGCM2.Domain</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user