54 lines
3.0 KiB
C#
54 lines
3.0 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 Proker(string ProkerID, string AgentID, byte Kegiatan, string Sasaran, byte? StartDay,
|
|
byte StartMonth, short Year, byte TimeTarget, bool IsInMonth, string EntityTarget, string Indicators, string Actions);
|
|
internal partial record ProkerJournal(string ProkerID, string OwnerID, byte Kegiatan, string Sasaran, byte? StartDay,
|
|
byte StartMonth, short Year, byte TimeTarget, bool IsInMonth, string EntityTarget, string Indicators, string Actions,
|
|
string JournalID, string SubmitterID, string Notes, byte Status, string? Document, DateTime TimeStamp);
|
|
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(Proker))]
|
|
[JsonSerializable(typeof(ProkerJournal))]
|
|
[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<Proker>))]
|
|
[JsonSerializable(typeof(List<ProkerJournal>))]
|
|
[JsonSerializable(typeof(List<SafeUser>))]
|
|
[JsonSerializable(typeof(List<string>))]
|
|
[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();
|
|
} |