31 lines
904 B
C#
31 lines
904 B
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(Level), nameof(UserId), IsUnique = true)]
|
|
public class SubscriptionTierModel : EntityBase
|
|
{
|
|
[Required]
|
|
public required string Name { get; set; }
|
|
|
|
[MaxLength(1000)]
|
|
public string? Description { get; set; }
|
|
|
|
[Required]
|
|
[ForeignKey(nameof(User))]
|
|
public Guid UserId { get; set; }
|
|
|
|
[DeleteBehavior(DeleteBehavior.Cascade)]
|
|
public required virtual UserModel User { get; set; }
|
|
|
|
public decimal MonthlyPrice { get; set; }
|
|
public int Level { get; set; }
|
|
|
|
public virtual IList<PromptModel> Prompts { get; set; } = new List<PromptModel>();
|
|
public virtual IList<SubscriptionModel> Subscriptions { get; set; } = new List<SubscriptionModel>();
|
|
}
|
|
}
|