31 lines
1.0 KiB
C#
31 lines
1.0 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using OnlyPrompt.Backend.Database.Core;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace OnlyPrompt.Backend.Database.Models
|
|
{
|
|
[Index(nameof(Email), IsUnique = true)]
|
|
[Index(nameof(UserName), IsUnique = true)]
|
|
public class UserModel : EntityBase
|
|
{
|
|
[MaxLength(100)]
|
|
[Column(TypeName = "citext")]
|
|
public required string UserName { get; set; }
|
|
|
|
[Column(TypeName = "citext")]
|
|
public required string Email { get; set; }
|
|
public required string PasswordHash { get; set; }
|
|
public required string[] Roles { get; set; }
|
|
|
|
[Required]
|
|
public required virtual UserProfileModel Profile { get; set; }
|
|
|
|
public virtual IList<PromptModel> Prompts { get; set; } = new List<PromptModel>();
|
|
public virtual IList<SubscriptionModel> Subscriptions { get; set; } = new List<SubscriptionModel>();
|
|
public virtual IList<SubscriptionModel> Subscribers { get; set; } = new List<SubscriptionModel>();
|
|
|
|
public bool IsLockoutEnabled { get; set; } = false;
|
|
}
|
|
}
|