44 lines
2.3 KiB
C#
44 lines
2.3 KiB
C#
using System;
|
|
using System.Text.Json;
|
|
using System.Text.Json.Serialization;
|
|
using System.Text.RegularExpressions;
|
|
|
|
namespace perubahan;
|
|
internal partial record Agent(string AgentID, string Name, string Jabatan, short DeplID, string SKAngkat, DateOnly TMT, string? SKPerb, DateOnly? TMUbah, string? Vision, string? Mission, string? PhotoURL, string? Seleksi, DateOnly? NilaiPilih, string? Eviden, string? Dokumentasi);
|
|
internal partial record ApiResponse(int Status, string Message, object Data);
|
|
internal partial record Deployment(short DeplID, string UnitKerja);
|
|
internal partial record LoginUser(string Username, string Password);
|
|
internal partial record PasswdUser(string Username, string PlainPassword);
|
|
internal partial record SafeUser(string Username, string AgentID, byte Level, bool Active) {
|
|
internal static SafeUser FromUser(User Source)
|
|
{
|
|
return new(Source.Username, Source.AgentID, Source.Level, Source.Active);
|
|
}
|
|
};
|
|
internal partial record SimpleApiResponse(int Status, string Message);
|
|
internal partial record User(string Username, string AgentID, string Password, byte Level, bool Active);
|
|
[JsonSerializable(typeof(Agent))]
|
|
[JsonSerializable(typeof(ApiResponse))]
|
|
[JsonSerializable(typeof(Deployment))]
|
|
[JsonSerializable(typeof(JsonElement))]
|
|
[JsonSerializable(typeof(JsonElement[]))]
|
|
[JsonSerializable(typeof(LoginUser))]
|
|
[JsonSerializable(typeof(PasswdUser))]
|
|
[JsonSerializable(typeof(SafeUser))]
|
|
[JsonSerializable(typeof(SimpleApiResponse))]
|
|
[JsonSerializable(typeof(User))]
|
|
//////////----------DICTIONARIES----------//////////
|
|
[JsonSerializable(typeof(Dictionary<string, JsonElement>))]
|
|
[JsonSerializable(typeof(ConcurrentDictionary<string, User>))]
|
|
//////////-------------LISTS--------------//////////
|
|
[JsonSerializable(typeof(List<Agent>))]
|
|
[JsonSerializable(typeof(List<Deployment>))]
|
|
[JsonSerializable(typeof(List<SafeUser>))]
|
|
[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Default, PropertyNameCaseInsensitive = true, PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
|
|
internal partial class SGContext : JsonSerializerContext { }
|
|
|
|
internal static partial class Regices
|
|
{
|
|
[GeneratedRegex(@"data:image/(?<format>.+?);base64,(?<data>.+)")]
|
|
internal static partial Regex Base64Regex();
|
|
} |