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),
};
}
}
}