Adds subscriptions
This commit is contained in:
@@ -21,13 +21,23 @@ public class ContentDbContext(
|
||||
.Property(c => c.CreatedAt)
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasDefaultValueSql("CURRENT_TIMESTAMP");
|
||||
|
||||
|
||||
modelBuilder
|
||||
.Entity<Content>()
|
||||
.HasOne(c => c.Creator)
|
||||
.WithMany()
|
||||
.HasForeignKey(c => c.CreatedBy);
|
||||
|
||||
modelBuilder
|
||||
.Entity<Subscription>()
|
||||
.HasOne(c => c.Creator)
|
||||
.WithMany()
|
||||
.HasForeignKey(c => c.CreatorId);
|
||||
|
||||
modelBuilder
|
||||
.Entity<Subscription>()
|
||||
.HasKey(s => new { s.CreatedBy, s.CreatorId });
|
||||
|
||||
modelBuilder
|
||||
.Entity<Creator>()
|
||||
.OwnsOne<About>(x => x.About);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
public class Subscription
|
||||
{
|
||||
public Guid Id { get; init; }
|
||||
public Guid CreatorId { get; init; }
|
||||
public Guid CreatedBy { get; init; }
|
||||
public DateTimeOffset CreatedAt { get; init; }
|
||||
public Guid CreatorId { get; init; }
|
||||
public Creator? Creator { get; set; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user