Add prompt marketplace interactions and profile prompt tabs
This commit is contained in:
1 parent
691bc72681
commit
c95319b1fe
20 files changed
+734
-146
No files matched your search
@@ -14,6 +14,8 @@ namespace OnlyPrompt.Backend.Database
|
||||
public DbSet<SubscriptionTierModel> SubscriptionTiers { get; set; }
|
||||
public DbSet<SubscriptionModel> Subscriptions { get; set; }
|
||||
public DbSet<ReviewModel> Reviews { get; set; }
|
||||
public DbSet<PromptLikeModel> PromptLikes { get; set; }
|
||||
public DbSet<PromptSaveModel> PromptSaves { get; set; }
|
||||
|
||||
public OnlyPromptContext(DbContextOptions<OnlyPromptContext> options) : base(options)
|
||||
{
|
||||
@@ -85,6 +87,36 @@ namespace OnlyPrompt.Backend.Database
|
||||
.WithMany(t => t.Subscriptions)
|
||||
.HasForeignKey(e => e.SubscriptionTierId)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PromptLikeModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.PromptId, e.UserId });
|
||||
|
||||
entity.HasOne(e => e.Prompt)
|
||||
.WithMany(p => p.Likes)
|
||||
.HasForeignKey(e => e.PromptId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasOne(e => e.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<PromptSaveModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.PromptId, e.UserId });
|
||||
|
||||
entity.HasOne(e => e.Prompt)
|
||||
.WithMany(p => p.Saves)
|
||||
.HasForeignKey(e => e.PromptId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
entity.HasOne(e => e.User)
|
||||
.WithMany()
|
||||
.HasForeignKey(e => e.UserId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user