init
This commit is contained in:
commit
f4c0a40259
27 changed files with 2188 additions and 0 deletions
23
Foxnouns.Backend/Database/Models/AuthMethod.cs
Normal file
23
Foxnouns.Backend/Database/Models/AuthMethod.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
namespace Foxnouns.Backend.Database.Models;
|
||||
|
||||
public class AuthMethod : BaseModel
|
||||
{
|
||||
public required AuthType AuthType { get; init; }
|
||||
public required string RemoteId { get; init; }
|
||||
public string? RemoteUsername { get; set; }
|
||||
|
||||
public Snowflake UserId { get; init; }
|
||||
public User User { get; init; } = null!;
|
||||
|
||||
public Snowflake? FediverseApplicationId { get; init; }
|
||||
public FediverseApplication? FediverseApplication { get; init; }
|
||||
}
|
||||
|
||||
public enum AuthType
|
||||
{
|
||||
Discord,
|
||||
Google,
|
||||
Tumblr,
|
||||
Fediverse,
|
||||
Email,
|
||||
}
|
15
Foxnouns.Backend/Database/Models/FediverseApplication.cs
Normal file
15
Foxnouns.Backend/Database/Models/FediverseApplication.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
namespace Foxnouns.Backend.Database.Models;
|
||||
|
||||
public class FediverseApplication : BaseModel
|
||||
{
|
||||
public required string Domain { get; init; }
|
||||
public required string ClientId { get; set; }
|
||||
public required string ClientSecret { get; set; }
|
||||
public required FediverseInstanceType InstanceType { get; set; }
|
||||
}
|
||||
|
||||
public enum FediverseInstanceType
|
||||
{
|
||||
MastodonApi,
|
||||
MisskeyApi
|
||||
}
|
18
Foxnouns.Backend/Database/Models/Field.cs
Normal file
18
Foxnouns.Backend/Database/Models/Field.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Foxnouns.Backend.Database.Models;
|
||||
|
||||
public class Field
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public FieldEntry[] Entries { get; set; } = [];
|
||||
}
|
||||
|
||||
public class FieldEntry
|
||||
{
|
||||
public required string Value { get; set; }
|
||||
public required string Status { get; set; }
|
||||
}
|
||||
|
||||
public class Pronoun : FieldEntry
|
||||
{
|
||||
public string? DisplayText { get; set; }
|
||||
}
|
18
Foxnouns.Backend/Database/Models/Member.cs
Normal file
18
Foxnouns.Backend/Database/Models/Member.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
namespace Foxnouns.Backend.Database.Models;
|
||||
|
||||
public class Member : BaseModel
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
public string? DisplayName { get; set; }
|
||||
public string? Bio { get; set; }
|
||||
public string? Avatar { get; set; }
|
||||
public string[] Links { get; set; } = [];
|
||||
public bool Unlisted { get; set; }
|
||||
|
||||
public List<FieldEntry> Names { get; set; } = [];
|
||||
public List<Pronoun> Pronouns { get; set; } = [];
|
||||
public List<Field> Fields { get; set; } = [];
|
||||
|
||||
public Snowflake UserId { get; init; }
|
||||
public User User { get; init; } = null!;
|
||||
}
|
15
Foxnouns.Backend/Database/Models/Token.cs
Normal file
15
Foxnouns.Backend/Database/Models/Token.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using NodaTime;
|
||||
|
||||
namespace Foxnouns.Backend.Database.Models;
|
||||
|
||||
public class Token : BaseModel
|
||||
{
|
||||
public required Instant ExpiresAt { get; init; }
|
||||
public required string[] Scopes { get; init; }
|
||||
public bool ManuallyExpired { get; set; }
|
||||
|
||||
public bool IsExpired => ManuallyExpired || ExpiresAt < SystemClock.Instance.GetCurrentInstant();
|
||||
|
||||
public Snowflake UserId { get; init; }
|
||||
public User User { get; init; } = null!;
|
||||
}
|
27
Foxnouns.Backend/Database/Models/User.cs
Normal file
27
Foxnouns.Backend/Database/Models/User.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
namespace Foxnouns.Backend.Database.Models;
|
||||
|
||||
public class User : BaseModel
|
||||
{
|
||||
public required string Username { get; set; }
|
||||
public string? DisplayName { get; set; }
|
||||
public string? Bio { get; set; }
|
||||
public string? MemberTitle { get; set; }
|
||||
public string? Avatar { get; set; }
|
||||
public string[] Links { get; set; } = [];
|
||||
|
||||
public List<FieldEntry> Names { get; set; } = [];
|
||||
public List<Pronoun> Pronouns { get; set; } = [];
|
||||
public List<Field> Fields { get; set; } = [];
|
||||
|
||||
public UserRole Role { get; set; } = UserRole.User;
|
||||
|
||||
public List<Member> Members { get; } = [];
|
||||
public List<AuthMethod> AuthMethods { get; } = [];
|
||||
}
|
||||
|
||||
public enum UserRole
|
||||
{
|
||||
User,
|
||||
Moderator,
|
||||
Admin,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue