feat: stream tickets

This commit is contained in:
2024-08-19 10:10:59 +01:00
parent 3148b2cf6f
commit 015b75f894
9 changed files with 654 additions and 13 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}
}