safeuser refactor

This commit is contained in:
nugroho 2025-05-20 15:57:38 +07:00
parent c6c2dea10c
commit 68cfb26316

View File

@ -12,11 +12,11 @@ internal partial record PasswdUser(string Username, string PlainPassword);
internal partial record SafeUser(string Username, string AgentID, byte Level, bool Active) { internal partial record SafeUser(string Username, string AgentID, byte Level, bool Active) {
internal static SafeUser FromUser(User Source) internal static SafeUser FromUser(User Source)
{ {
return new(Source.Username, Source.Name, Source.Level, Source.Active); return new(Source.Username, Source.AgentID, Source.Level, Source.Active);
} }
}; };
internal partial record SimpleApiResponse(int Status, string Message); internal partial record SimpleApiResponse(int Status, string Message);
internal partial record User(string Username, string Name, string Password, byte Level, bool Active); internal partial record User(string Username, string AgentID, string Password, byte Level, bool Active);
[JsonSerializable(typeof(Agent))] [JsonSerializable(typeof(Agent))]
[JsonSerializable(typeof(ApiResponse))] [JsonSerializable(typeof(ApiResponse))]
[JsonSerializable(typeof(Deployment))] [JsonSerializable(typeof(Deployment))]
@ -29,6 +29,7 @@ internal partial record User(string Username, string Name, string Password, byte
[JsonSerializable(typeof(User))] [JsonSerializable(typeof(User))]
//////////----------DICTIONARIES----------////////// //////////----------DICTIONARIES----------//////////
[JsonSerializable(typeof(Dictionary<string, JsonElement>))] [JsonSerializable(typeof(Dictionary<string, JsonElement>))]
// [JsonSerializable(typeof(ConcurrentDictionary<string, User>))]
//////////-------------LISTS--------------////////// //////////-------------LISTS--------------//////////
[JsonSerializable(typeof(List<Agent>))] [JsonSerializable(typeof(List<Agent>))]
[JsonSerializable(typeof(List<Deployment>))] [JsonSerializable(typeof(List<Deployment>))]