V2 upgrade

This commit is contained in:
2023-07-25 17:45:44 +01:00
parent dae8f99d33
commit 3c16cb51d4
41 changed files with 2056 additions and 427 deletions

View File

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