PluralKit/PluralKit.Core/Models/PKSystem.cs
2021-03-28 12:02:41 +02:00

40 lines
1.3 KiB
C#

using Dapper.Contrib.Extensions;
using Newtonsoft.Json;
using NodaTime;
namespace PluralKit.Core {
public class PKSystem
{
// Additions here should be mirrored in SystemStore::Save
[Key] public SystemId Id { get; }
public string Hid { get; }
public string Name { get; }
public string Description { get; }
public string Tag { get; }
public string AvatarUrl { get; }
public string Color { get; }
public string Token { get; }
public Instant Created { get; }
public string UiTz { get; set; }
public bool PingsEnabled { get; }
public int? LatchTimeout { get; }
public PrivacyLevel DescriptionPrivacy { get; }
public PrivacyLevel MemberListPrivacy { get;}
public PrivacyLevel FrontPrivacy { get; }
public PrivacyLevel FrontHistoryPrivacy { get; }
public PrivacyLevel GroupListPrivacy { get; }
public int? MemberLimitOverride { get; }
public int? GroupLimitOverride { get; }
[JsonIgnore] public DateTimeZone Zone => DateTimeZoneProviders.Tzdb.GetZoneOrNull(UiTz);
}
public static class PKSystemExt
{
public static string DescriptionFor(this PKSystem system, LookupContext ctx) =>
system.DescriptionPrivacy.Get(ctx, system.Description);
}
}