feat: add social proof features and comprehensive documentation
Priority 2 - Social Proof: - Add ToolRating and ToolReview models to Prisma schema - Add rating aggregates (averageRating, ratingCount, reviewCount) to Tool model - Create /api/tools/[id]/rate endpoint for tool ratings - Create /api/tools/[id]/reviews endpoint for tool reviews - Create /api/tools/trending endpoint for trending tools - Add Rating component with interactive star rating - Add ReviewCard component with user avatars and review display - Add star and starFilled icons to UI package - Update ToolDetailClient to show ratings Priority 3 - Documentation: - Create /docs/api/tools API documentation page - Create /docs/api/agents API documentation page - Create /docs/api/collections API documentation page - Create /docs/api/authentication documentation page - Create /docs/quickstart getting started tutorial - Create /docs/sdk SDK reference documentation
This commit is contained in:
parent
d22d0e6f59
commit
b1dd3371cd
15 changed files with 3736 additions and 5 deletions
|
|
@ -95,16 +95,26 @@ model Tool {
|
|||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
// Rating aggregates
|
||||
averageRating Decimal? @map("average_rating") @db.Decimal(2, 1) // 1.0 to 5.0
|
||||
ratingCount Int @default(0) @map("rating_count")
|
||||
reviewCount Int @default(0) @map("review_count")
|
||||
|
||||
// Relations
|
||||
simulations Simulation[]
|
||||
healthChecks HealthCheck[]
|
||||
collections CollectionTool[]
|
||||
agents AgentTool[]
|
||||
likes ToolLike[]
|
||||
ratings ToolRating[]
|
||||
reviews ToolReview[]
|
||||
|
||||
@@unique([packageId, name])
|
||||
@@index([qualityScore])
|
||||
@@index([likeCount])
|
||||
@@index([averageRating])
|
||||
@@index([ratingCount])
|
||||
@@index([reviewCount])
|
||||
@@index([importHealth])
|
||||
@@index([executionHealth])
|
||||
@@index([lastHealthCheck])
|
||||
|
|
@ -346,6 +356,8 @@ model User {
|
|||
agents Agent[]
|
||||
apiKeys UserApiKey[]
|
||||
toolLikes ToolLike[]
|
||||
toolRatings ToolRating[]
|
||||
toolReviews ToolReview[]
|
||||
collectionLikes CollectionLike[]
|
||||
agentLikes AgentLike[]
|
||||
activities UserActivity[]
|
||||
|
|
@ -761,6 +773,65 @@ model AgentLike {
|
|||
@@map("agent_likes")
|
||||
}
|
||||
|
||||
/// ToolRating - user ratings for tools (1-5 stars)
|
||||
model ToolRating {
|
||||
id String @id @default(cuid())
|
||||
|
||||
// Relationships
|
||||
userId String @map("user_id")
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
toolId String @map("tool_id")
|
||||
tool Tool @relation(fields: [toolId], references: [id], onDelete: Cascade)
|
||||
|
||||
// Rating value (1-5)
|
||||
rating Int @db.SmallInt
|
||||
|
||||
// Timestamps
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@unique([userId, toolId])
|
||||
@@index([toolId])
|
||||
@@index([userId])
|
||||
@@index([rating])
|
||||
@@map("tool_ratings")
|
||||
}
|
||||
|
||||
/// ToolReview - user reviews for tools
|
||||
model ToolReview {
|
||||
id String @id @default(cuid())
|
||||
|
||||
// Relationships
|
||||
userId String @map("user_id")
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
toolId String @map("tool_id")
|
||||
tool Tool @relation(fields: [toolId], references: [id], onDelete: Cascade)
|
||||
|
||||
// Review content
|
||||
title String? @db.VarChar(200)
|
||||
content String @db.Text
|
||||
rating Int @db.SmallInt // 1-5, denormalized for convenience
|
||||
|
||||
// Moderation
|
||||
isApproved Boolean @default(true) @map("is_approved")
|
||||
isHidden Boolean @default(false) @map("is_hidden")
|
||||
|
||||
// Helpful votes
|
||||
helpfulCount Int @default(0) @map("helpful_count")
|
||||
|
||||
// Timestamps
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
@@unique([userId, toolId])
|
||||
@@index([toolId])
|
||||
@@index([userId])
|
||||
@@index([rating])
|
||||
@@index([isApproved, isHidden])
|
||||
@@index([createdAt])
|
||||
@@map("tool_reviews")
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// Activity Stream Models
|
||||
// ============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue