2024-04-16 16:17:48 -05:00

62 lines
1.4 KiB
C#

using DAL.Models.Audits;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace DAL.Models
{
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum HashingType
{
PBKDF2_SHA512_64_210000
}
[Table("users")]
[Index("updater", Name = "users_users_id_fk")]
[Index("permissionId", Name = "users_permissions_id_fk")]
public class User
{
[Key]
[Column("id")]
public ulong id { get; set; }
[Column("firstName")]
[MaxLength(64)]
public string firstName { get; set; } = null!;
[Column("lastName")]
[MaxLength(64)]
public string lastName { get; set; } = null!;
[Column("phoneNumber")]
public ulong phoneNumber { get; set; }
[Column("password")]
[MaxLength(1000)]
public string password { get; set; } = null!;
[Column("salt")]
[DataType("blob")]
public byte[] salt { get; set; } = null!;
[Column("hashingType")]
[MaxLength(64)]
public HashingType hashingType { get; set; }
[Column("permissionId")]
public ulong permissionId { get; set; }
[Column("updated")]
[DataType("datetime")]
public DateTime updated { get; set; }
[Column("updater")]
public ulong updater { get; set; }
public virtual User updaterRelation { get; set; } = null!;
public ICollection<AuditUser> audits { get; set; } = new List<AuditUser>();
}
}