Files
zap-stream-api/NostrStreamer/Database/Configuration/PaymentsConfiguration.cs
2024-03-22 12:59:12 +00:00

32 lines
870 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace NostrStreamer.Database.Configuration;
public class PaymentsConfiguration : IEntityTypeConfiguration<Payment>
{
public void Configure(EntityTypeBuilder<Payment> builder)
{
builder.HasKey(a => a.PaymentHash);
builder.Property(a => a.Invoice);
builder.Property(a => a.IsPaid)
.IsRequired();
builder.Property(a => a.Amount)
.IsRequired();
builder.Property(a => a.Created)
.IsRequired();
builder.Property(a => a.Nostr);
builder.Property(a => a.Type)
.IsRequired();
builder.Property(a => a.Fee)
.IsRequired();
builder.HasOne(a => a.User)
.WithMany(a => a.Payments)
.HasForeignKey(a => a.PubKey);
}
}