V2 upgrade
This commit is contained in:
@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace NostrStreamer.Database.Configuration;
|
||||
|
||||
public class IngestEndpointConfiguration : IEntityTypeConfiguration<IngestEndpoint>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<IngestEndpoint> builder)
|
||||
{
|
||||
builder.HasKey(a => a.Id);
|
||||
|
||||
builder.Property(a => a.Name)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.App)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Forward)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Cost)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Capabilities)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasIndex(a => a.App)
|
||||
.IsUnique();
|
||||
}
|
||||
}
|
@ -19,7 +19,11 @@ public class PaymentsConfiguration : IEntityTypeConfiguration<Payment>
|
||||
|
||||
builder.Property(a => a.Created)
|
||||
.IsRequired();
|
||||
|
||||
|
||||
builder.Property(a => a.Nostr);
|
||||
builder.Property(a => a.Type)
|
||||
.IsRequired();
|
||||
|
||||
builder.HasOne(a => a.User)
|
||||
.WithMany(a => a.Payments)
|
||||
.HasForeignKey(a => a.PubKey);
|
||||
|
@ -11,7 +11,6 @@ public class UserConfiguration : IEntityTypeConfiguration<User>
|
||||
builder.Property(a => a.StreamKey)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Event);
|
||||
builder.Property(a => a.Balance)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace NostrStreamer.Database.Configuration;
|
||||
|
||||
public class UserStreamConfiguration : IEntityTypeConfiguration<UserStream>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserStream> builder)
|
||||
{
|
||||
builder.HasKey(a => a.Id);
|
||||
builder.Property(a => a.ClientId)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Starts)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Ends);
|
||||
|
||||
builder.Property(a => a.State)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Event)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Recording);
|
||||
|
||||
builder.HasOne(a => a.Endpoint)
|
||||
.WithMany()
|
||||
.HasForeignKey(a => a.EndpointId);
|
||||
|
||||
builder.HasOne(a => a.User)
|
||||
.WithMany(a => a.Streams)
|
||||
.HasForeignKey(a => a.PubKey);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
namespace NostrStreamer.Database.Configuration;
|
||||
|
||||
public class UserStreamGuestConfiguration : IEntityTypeConfiguration<UserStreamGuest>
|
||||
{
|
||||
public void Configure(EntityTypeBuilder<UserStreamGuest> builder)
|
||||
{
|
||||
builder.HasKey(a => a.Id);
|
||||
builder.Property(a => a.PubKey)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(a => a.Sig);
|
||||
builder.Property(a => a.Relay);
|
||||
builder.Property(a => a.Role);
|
||||
builder.Property(a => a.ZapSplit);
|
||||
|
||||
builder.HasOne(a => a.Stream)
|
||||
.WithMany(a => a.Guests)
|
||||
.HasForeignKey(a => a.StreamId);
|
||||
|
||||
builder.HasIndex(a => new {a.StreamId, a.PubKey})
|
||||
.IsUnique();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user