void.cat/VoidCat/Database/Configurations/PaywallOrderConfiguration.cs
Kieran 4de977c1dd
All checks were successful
continuous-integration/drone/push Build is passing
v5 (#65)
Co-authored-by: Kieran <kieran@harkin.me>
Reviewed-on: #65
2023-05-09 13:56:57 +00:00

31 lines
796 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace VoidCat.Database.Configurations;
public class PaywallOrderConfiguration : IEntityTypeConfiguration<PaywallOrder>
{
public void Configure(EntityTypeBuilder<PaywallOrder> builder)
{
builder.ToTable("PaymentOrder");
builder.HasKey(a => a.Id);
builder.Property(a => a.Service)
.IsRequired();
builder.Property(a => a.Currency)
.IsRequired();
builder.Property(a => a.Amount)
.IsRequired();
builder.Property(a => a.Status)
.IsRequired();
builder.HasIndex(a => a.Status);
builder.HasOne(a => a.File)
.WithMany()
.HasForeignKey(a => a.FileId);
}
}