namespace LookingGlass.Data; public class User { public int Id { get; set; } public string Token { get; set; } = default!; public int DiscordUserId { get; set; } public DateTime CreatedAt { get; set; } public bool WriteAccess { get; set; } = false; public bool Disabled { get; set; } = false; public static User FromToken(string token, ApplicationContext context) { User user = context.User.First(u => u.Token == token) ?? throw new Exception("User not found"); if (user.Disabled) { throw new Exception("User not found"); } return user; } }