api e token con ck in db

This commit is contained in:
Riccardo Usardi committed 2025-07-09 18:51:18 +02:00
1 parent a172f05269
commit 2db9525570
18 files changed
+570 -161

No files matched your search

+1
View File
@@ -26,4 +26,5 @@
Note = reader.GetString("note")
};
}
}
}
+13 -1
View File
@@ -1,9 +1,21 @@
namespace uWine.Core.Domain.Entities
using MySqlConnector;
namespace uWine.Core.Domain.Entities
{
public class Role
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public static Role FromRecord(MySqlDataReader reader)
{
return new Role
{
Id = reader.GetInt32("role_id"),
Name = reader.GetString("name"),
Description = reader.GetString("description")
};
}
}
}
+12 -1
View File
@@ -1,4 +1,6 @@
namespace uWine.Core.Domain.Entities
using MySqlConnector;
namespace uWine.Core.Domain.Entities
{
public class User
{
@@ -8,5 +10,14 @@
public Role Role { get; set; }
public bool Active { get; set; }
public List<Owner> Owners { get; set; }
public static User LoginUser(MySqlDataReader reader)
{
return new User
{
Id = reader.GetInt32("id"),
Username = reader.GetString("username"),
Role = Role.FromRecord(reader),
};
}
}
}
@@ -6,5 +6,6 @@ namespace uWine.Core.Domain.Repositories
public interface IAuthenticationRepository
{
bool Valid(User user);
User LoggedUser(User user);
}
}
@@ -14,7 +14,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("uWine.Core.Domain")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7941a858fdaae67757b9b4caff965d2721e9b28d")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a172f05269c07a86949730b68f466dbb39efd35c")]
[assembly: System.Reflection.AssemblyProductAttribute("uWine.Core.Domain")]
[assembly: System.Reflection.AssemblyTitleAttribute("uWine.Core.Domain")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
@@ -1 +1 @@
d2610517bddbb48769c9f8f62bd9f8107a8dab356a5412c7a5c3dfc9b3ba2edd
8b28d92b53d240bb0fa1329b33b29da5b306fb49220cf2f4e3d5082767ed6f9b