feat: stream tickets
This commit is contained in:
@ -0,0 +1,22 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace NostrStreamer.Database.Configuration;
|
||||
|
||||
public class StreamTicketsConfiguration : IEntityTypeConfiguration<StreamTickets>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<StreamTickets> builder)
|
||||
{
|
||||
builder.HasKey(a => a.Id);
|
||||
|
||||
builder.Property(a => a.Created)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Token)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(a => a.UserStream)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.UserStreamId);
|
||||
}
|
||||
}
|
@ -32,7 +32,9 @@ public class UserStreamConfiguration : IEntityTypeConfiguration<UserStream>
|
||||
|
||||
builder.Property(a => a.LastSegment)
|
||||
.IsRequired();
|
||||
|
||||
|
||||
builder.Property(a => a.AdmissionCost);
|
||||
|
||||
builder.HasOne(a => a.Endpoint)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.EndpointId);
|
||||
@ -41,4 +43,4 @@ public class UserStreamConfiguration : IEntityTypeConfiguration<UserStream>
|
||||
.WithMany(a => a.Streams)
|
||||
.HasForeignKey(a => a.PubKey);
|
||||
}
|
||||
}
|
||||
}
|
@ -30,8 +30,9 @@ public class Payment
|
||||
|
||||
public enum PaymentType
|
||||
{
|
||||
Topup = 0,
|
||||
TopUp = 0,
|
||||
Zap = 1,
|
||||
Credit = 2,
|
||||
Withdrawal = 3,
|
||||
AdmissionFee = 4,
|
||||
}
|
13
NostrStreamer/Database/StreamTickets.cs
Normal file
13
NostrStreamer/Database/StreamTickets.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace NostrStreamer.Database;
|
||||
|
||||
public class StreamTickets
|
||||
{
|
||||
public Guid Id { get; init; } = Guid.NewGuid();
|
||||
|
||||
public Guid UserStreamId { get; init; }
|
||||
public UserStream UserStream { get; init; } = null!;
|
||||
|
||||
public DateTime Created { get; init; } = DateTime.UtcNow;
|
||||
|
||||
public Guid Token { get; init; } = Guid.NewGuid();
|
||||
}
|
@ -8,18 +8,18 @@ public class UserStream
|
||||
public User User { get; init; } = null!;
|
||||
|
||||
public string StreamId { get; init; } = null!;
|
||||
|
||||
|
||||
public DateTime Starts { get; init; } = DateTime.UtcNow;
|
||||
|
||||
|
||||
public DateTime? Ends { get; set; }
|
||||
|
||||
|
||||
public UserStreamState State { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Nostr Event for this stream
|
||||
/// </summary>
|
||||
public string Event { get; set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// URL of auto-generated thumbnail
|
||||
/// </summary>
|
||||
@ -32,24 +32,29 @@ public class UserStream
|
||||
/// Publisher edge IP
|
||||
/// </summary>
|
||||
public string EdgeIp { get; set; } = null!;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Publisher edge client id
|
||||
/// </summary>
|
||||
public string ForwardClientId { get; set; } = null!;
|
||||
|
||||
public DateTime LastSegment { get; set; } = DateTime.UtcNow;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Total sats charged during this stream
|
||||
/// </summary>
|
||||
public decimal MilliSatsCollected { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Total seconds produced in HLS segments
|
||||
/// </summary>
|
||||
public decimal Length { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Cost to view stream, tickets in <see cref="StreamTickets"/>
|
||||
/// </summary>
|
||||
public decimal? AdmissionCost { get; set; }
|
||||
|
||||
public List<UserStreamGuest> Guests { get; init; } = new();
|
||||
|
||||
public List<UserStreamRecording> Recordings { get; init; } = new();
|
||||
|
Reference in New Issue
Block a user