Skip to main content

Review

A user can rate and write a short review of any agent they have access to.

Schema (reviews)

ColumnTypeNotes
idUUIDPK
agentIdUUIDFK → agents
userIdUUIDFK → user
ratingint1–5, CHECK (rating BETWEEN 1 AND 5)
titletext, nullableShort headline
bodytext, nullableLong-form text
createdAt, updatedAttimestamptz

Unique on (agentId, userId). Submitting a second review is an upsert that replaces the old content.

Endpoints

VerbPathGuard
GET/agents/:agentId/reviews?cursor=&limit=public, cursor-paginated, newest first
POST/agents/:agentId/reviewsbearer (upsert)
DELETE/reviews/:idbearer — author or platform_admin

DTO

type ReviewDto = {
id: string;
rating: number;
title: string | null;
body: string | null;
userDisplayName: string | null;
userAvatarUrl: string | null;
createdAt: string;
updatedAt: string;
};

User display name and avatar are joined from auth.user at read time. Deleting the user does NOT cascade — the review remains but loses the linked profile fields (they go null).

Aggregates on the agent

The agent DTO carries rating (1-decimal mean) and reviewCount. Both are computed at read time from the reviews table. rating is null if reviewCount === 0.

Frontend rendering

The detail page has a Reviews tab fed by useAgentReviews(agentId, { cursor }). Inline review submission uses useUpsertReview() and useDeleteReview().

Moderation

There is no current moderation queue. Reviews are public on insert. Admins can delete via DELETE /reviews/:id. If you need pre-moderation, add a status: 'pending' | 'approved' | 'rejected' column — currently absent.