Add and remove reaction from a content

This commit is contained in:
Dominic Villemure
2024-08-24 18:39:09 -04:00
parent 63dc032aa4
commit 588be7941c
17 changed files with 660 additions and 45 deletions

View File

@@ -1,4 +1,6 @@
namespace Hutopy.Web.Features.Contents.Data;
using Humanizer;
namespace Hutopy.Web.Features.Contents.Data;
public class ContentDbContext(
DbContextOptions<ContentDbContext> options)
@@ -25,6 +27,11 @@ public class ContentDbContext(
.HasOne(c => c.Creator)
.WithMany()
.HasForeignKey(c => c.CreatedBy);
modelBuilder
.Entity<Content>()
.OwnsMany(c => c.Reactions)
.ToTable(nameof(ContentReaction).Pluralize());
modelBuilder
.Entity<Subscription>()