DVR
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
@ -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>();
|
||||
}
|
||||
|
@ -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
|
||||
|
15
NostrStreamer/Database/UserStreamRecording.cs
Normal file
15
NostrStreamer/Database/UserStreamRecording.cs
Normal 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; }
|
||||
}
|
Reference in New Issue
Block a user