Topup functions
This commit is contained in:
@ -7,11 +7,21 @@ public class PaymentsConfiguration : IEntityTypeConfiguration<Payment>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<Payment> builder)
|
||||
{
|
||||
builder.HasKey(a => a.PubKey);
|
||||
builder.HasKey(a => a.PaymentHash);
|
||||
builder.Property(a => a.Invoice)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.IsPaid)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Amount)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Created)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(a => a.User)
|
||||
.WithMany(a => a.Payments)
|
||||
.HasForeignKey(a => a.PubKey);
|
||||
}
|
||||
}
|
||||
|
@ -14,5 +14,8 @@ public class UserConfiguration : IEntityTypeConfiguration<User>
|
||||
builder.Property(a => a.Event);
|
||||
builder.Property(a => a.Balance)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Version)
|
||||
.IsRowVersion();
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,16 @@ namespace NostrStreamer.Database;
|
||||
|
||||
public class Payment
|
||||
{
|
||||
public string PaymentHash { get; init; } = null!;
|
||||
|
||||
public string PubKey { get; init; } = null!;
|
||||
public User User { get; init; } = null!;
|
||||
|
||||
public string Invoice { get; init; } = null!;
|
||||
|
||||
public bool IsPaid { get; init; }
|
||||
public bool IsPaid { get; set; }
|
||||
|
||||
public ulong Amount { get; init; }
|
||||
|
||||
public DateTime Created { get; init; } = DateTime.UtcNow;
|
||||
}
|
||||
|
@ -38,4 +38,11 @@ public class User
|
||||
/// Comma seperated tags
|
||||
/// </summary>
|
||||
public string? Tags { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Concurrency token
|
||||
/// </summary>
|
||||
public uint Version { get; set; }
|
||||
|
||||
public List<Payment> Payments { get; init; } = new();
|
||||
}
|
||||
|
Reference in New Issue
Block a user