This commit is contained in:
2023-07-29 17:43:19 +01:00
parent 4f690b114d
commit c5c9c54518
24 changed files with 985 additions and 12 deletions

View File

@ -0,0 +1,24 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace NostrStreamer.Database.Configuration;
public class UserStreamRecordingConfiguration : IEntityTypeConfiguration<UserStreamRecording>
{
public void Configure(EntityTypeBuilder<UserStreamRecording> builder)
{
builder.HasKey(a => a.Id);
builder.Property(a => a.Url)
.IsRequired();
builder.Property(a => a.Timestamp)
.IsRequired();
builder.Property(a => a.Duration)
.IsRequired();
builder.HasOne(a => a.Stream)
.WithMany(a => a.Recordings)
.HasForeignKey(a => a.UserStreamId);
}
}

View File

@ -27,4 +27,6 @@ public class StreamerContext : DbContext
public DbSet<UserStreamGuest> Guests => Set<UserStreamGuest>();
public DbSet<IngestEndpoint> Endpoints => Set<IngestEndpoint>();
public DbSet<UserStreamRecording> Recordings => Set<UserStreamRecording>();
}

View File

@ -29,6 +29,7 @@ public class UserStream
public IngestEndpoint Endpoint { get; init; } = null!;
public List<UserStreamGuest> Guests { get; init; } = new();
public List<UserStreamRecording> Recordings { get; init; } = new();
}
public enum UserStreamState

View File

@ -0,0 +1,15 @@
namespace NostrStreamer.Database;
public class UserStreamRecording
{
public Guid Id { get; init; } = Guid.NewGuid();
public Guid UserStreamId { get; init; }
public UserStream Stream { get; init; } = null!;
public string Url { get; init; } = null!;
public DateTime Timestamp { get; init; } = DateTime.UtcNow;
public double Duration { get; init; }
}