mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-09 07:17:56 +00:00
refactor project structure
This commit is contained in:
parent
23d8592394
commit
c5d2b7c251
21 changed files with 54 additions and 25 deletions
53
PluralKit.Core/Models.cs
Normal file
53
PluralKit.Core/Models.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using System;
|
||||
using Dapper.Contrib.Extensions;
|
||||
|
||||
namespace PluralKit
|
||||
{
|
||||
[Table("systems")]
|
||||
public class PKSystem
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
public string Hid { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Tag { get; set; }
|
||||
public string AvatarUrl { get; set; }
|
||||
public string Token { get; set; }
|
||||
public DateTime Created { get; set; }
|
||||
public string UiTz { get; set; }
|
||||
|
||||
public int MaxMemberNameLength => Tag != null ? 32 - Tag.Length - 1 : 32;
|
||||
}
|
||||
|
||||
[Table("members")]
|
||||
public class PKMember
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Hid { get; set; }
|
||||
public int System { get; set; }
|
||||
public string Color { get; set; }
|
||||
public string AvatarUrl { get; set; }
|
||||
public string Name { get; set; }
|
||||
public DateTime? Birthday { get; set; }
|
||||
public string Pronouns { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string Prefix { get; set; }
|
||||
public string Suffix { get; set; }
|
||||
public DateTime Created { get; set; }
|
||||
|
||||
/// Returns a formatted string representing the member's birthday, taking into account that a year of "0001" is hidden
|
||||
public string BirthdayString
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Birthday == null) return null;
|
||||
if (Birthday?.Year == 1) return Birthday?.ToString("MMMM dd");
|
||||
return Birthday?.ToString("MMMM dd, yyyy");
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasProxyTags => Prefix != null || Suffix != null;
|
||||
public string ProxyString => $"{Prefix ?? ""}text{Suffix ?? ""}";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue