Connect prompt creation flow and document API

This commit is contained in:
nachbaisabel committed 2026-05-30 17:11:42 +02:00
1 parent 863cf3e0ef
commit 691bc72681
16 files changed
+567 -54

No files matched your search

@@ -31,11 +31,7 @@ namespace OnlyPrompt.Backend.Controllers
)
{
var userId = User.GetUserId();
var query = _db.Prompts
.Where(
x => x.Creator.Subscribers.Any(s => s.SubscriberId == userId)
&& x.CreatorId != userId
);
var query = _db.Prompts.AsQueryable();
if (category.HasValue)
query = query.Where(x => category.Value.Id.HasValue ? x.CategoryId == category.Value.Id.Value : x.Category.Slug == category.Value.Slug);
@@ -58,11 +54,14 @@ namespace OnlyPrompt.Backend.Controllers
.Select(x => new ApiMinimalPrompt(
x.Id,
x.Title,
x.Description,
x.UpdatedAt,
x.CreatorId,
x.Creator.Profile.DisplayName,
x.SubscriptionTier.Level,
x.SubscriptionTier.Name,
x.Creator.Profile.AvatarUrl,
x.ExampleImageUrl,
x.SubscriptionTier == null ? (int?)null : x.SubscriptionTier.Level,
x.SubscriptionTier == null ? null : x.SubscriptionTier.Name,
x.Reviews.Average(r => (double?)r.Rating),
x.SubscriptionTier == null || x.Creator.Subscribers.Any(s => s.SubscriberId == userId && x.SubscriptionTier.Level < s.SubscriptionTier.Level)
)).ToArrayAsync();