continuity/Continuity.AuthServer/DB/Documents/Account.cs

35 lines
1.1 KiB
C#
Raw Normal View History

2024-02-07 15:40:36 +00:00
// Licensed to Timothy Schenk under the GNU AGPL Version 3 License.
2023-11-20 18:58:30 +00:00
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Continuity.AuthServer.DB.Documents;
2023-08-10 08:47:35 +00:00
2023-11-19 16:07:28 +00:00
[Index(nameof(Username), IsUnique = true)]
[Index(nameof(Id), IsUnique = true)]
2023-08-14 11:49:27 +00:00
public class Account
2023-08-10 08:47:35 +00:00
{
public Account(string username, byte[] password, string email, byte permissionLevel, byte[] salt)
2023-08-10 08:47:35 +00:00
{
2023-11-19 16:07:28 +00:00
Username = username;
Password = password;
Email = email;
PermissionLevel = permissionLevel;
Salt = salt;
2023-08-10 08:47:35 +00:00
}
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
2023-08-14 19:30:32 +00:00
public Guid Id { get; set; }
[MaxLength(20)] public string Username { get; set; }
2023-11-16 11:06:36 +00:00
[Column(TypeName = "bytea")] public byte[] Password { get; set; }
[EmailAddress] public string Email { get; set; }
public byte PermissionLevel { get; set; }
[Column(TypeName = "bytea")] public byte[] Salt { get; set; }
2023-11-24 19:07:43 +00:00
public virtual ICollection<Character> Characters { get; set; }
2023-08-11 09:31:30 +00:00
}