2023-11-15 19:00:08 +00:00
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
2023-10-12 07:15:34 +00:00
|
|
|
namespace Server.DB.Documents;
|
2023-08-10 08:47:35 +00:00
|
|
|
|
2023-11-15 19:00:08 +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
|
|
|
{
|
2023-08-13 20:27:24 +00:00
|
|
|
public Account(string username, byte[] password, string email, byte permissionLevel, byte[] salt)
|
2023-08-10 08:47:35 +00:00
|
|
|
{
|
2023-08-11 09:31:30 +00:00
|
|
|
this.Username = username;
|
|
|
|
this.Password = password;
|
|
|
|
this.Email = email;
|
|
|
|
this.PermissionLevel = permissionLevel;
|
2023-08-13 20:27:24 +00:00
|
|
|
this.Salt = salt;
|
2023-08-10 08:47:35 +00:00
|
|
|
}
|
|
|
|
|
2023-11-15 19:00:08 +00:00
|
|
|
[Key]
|
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
2023-08-14 19:30:32 +00:00
|
|
|
public Guid Id { get; set; }
|
|
|
|
|
2023-11-15 19:00:08 +00:00
|
|
|
[Column(TypeName = "varchar(20)")] public string Username { get; set; }
|
|
|
|
[Column(TypeName = "bytea")] public byte[] Password { get; set; }
|
|
|
|
|
|
|
|
[EmailAddress] public string Email { get; set; }
|
2023-08-12 21:02:59 +00:00
|
|
|
public byte PermissionLevel { get; set; }
|
2023-11-15 19:00:08 +00:00
|
|
|
[Column(TypeName = "bytea")] public byte[] Salt { get; set; }
|
|
|
|
public virtual ICollection<Character> Characters { get; } = new List<Character>();
|
2023-08-11 09:31:30 +00:00
|
|
|
}
|