namespace VoidCat.Database; [Flags] public enum UserFlags { /// /// Profile is public /// PublicProfile = 1, /// /// Uploads list is public /// PublicUploads = 2, /// /// Account has email verified /// EmailVerified = 4 } public sealed class User { /// /// Unique Id of the user /// public Guid Id { get; init; } /// /// Users email address /// public string Email { get; set; } = null!; /// /// Users password (hashed) /// public string? Password { get; init; } /// /// When the user account was created /// public DateTime Created { get; init; } = DateTime.UtcNow; /// /// The last time the user logged in /// public DateTime? LastLogin { get; set; } /// /// Display avatar for user profile /// public string? Avatar { get; set; } /// /// Display name for user profile /// public string DisplayName { get; set; } = "void user"; /// /// Profile flags /// public UserFlags Flags { get; set; } = UserFlags.PublicProfile; /// /// Users storage system for new uploads /// public string Storage { get; set; } = "local-disk"; /// /// Account authentication type /// public UserAuthType AuthType { get; init; } /// /// Roles assigned to this user which grant them extra permissions /// public List Roles { get; init; } = new(); /// /// All files uploaded by this user /// public List UserFiles { get; init; } = new(); } public class UserRole { public Guid UserId { get; init; } public User User { get; init; } public string Role { get; init; } = null!; } public enum UserAuthType { /// /// Encrypted password /// Internal = 0, /// /// PGP challenge /// PGP = 1, /// /// OAuth2 token /// OAuth2 = 2, /// /// Lightning node challenge /// Lightning = 3, /// /// Nostr login /// Nostr = 4, }