Update documentation for reviews and interactions

This commit is contained in:
Thuvaraka Yogarajah 2026-06-01 22:18:03 +02:00
parent 07541e0bbe
commit e6d54d693f

63
API.md
View File

@ -111,6 +111,14 @@ Query parameters:
Response: list of creator cards including follow state and avatar URL.
### Public Profile
```http
GET /api/v1/profiles/{creatorId}
```
Used by public creator profiles. The response contains display name, slug, bio, avatar URL, average rating and subscriber count.
### Update Profile
```http
@ -142,7 +150,9 @@ Updates profile data used on My Profile, Community and the topbar.
GET /api/v1/prompts?sortBy=date&ascending=false&limit=50&search=cat
```
Used by Marketplace. Supports sorting, search and category filtering.
Used by Marketplace. Supports sorting, search and category filtering. The marketplace excludes prompts created by the logged-in user.
Response items include prompt title, description, creator id, creator name, creator avatar, example image, price, like/save counts, average rating, review count and access state.
### Feed
@ -150,7 +160,7 @@ Used by Marketplace. Supports sorting, search and category filtering.
GET /api/v1/feed?sortBy=date&ascending=false&limit=20
```
Used by Dashboard. Returns prompt cards with title, description, creator info, avatar and example image.
Used by Dashboard. Returns prompt cards from followed creators, excluding the logged-in user's own prompts.
### Create Prompt
@ -177,6 +187,23 @@ Request:
Response: created prompt. The frontend redirects to `/post-detail?id={id}`.
### Own Prompts
```http
GET /api/v1/prompts/mine
```
Used by My Profile to show prompts created by the logged-in user.
### Update Prompt
```http
PUT /api/v1/prompts/{id}
Content-Type: application/json
```
Request body uses the same editable fields as prompt creation. Used by the edit prompt flow.
### Prompt Detail
```http
@ -192,7 +219,21 @@ Response includes:
- price or free state
- example output
- example image
- rating data
- average rating and review count
- like/save state and counts
Paid prompts return no detail content for users without access.
### Likes and Saves
```http
PUT /api/v1/prompts/{id}/likes
DELETE /api/v1/prompts/{id}/likes
PUT /api/v1/prompts/{id}/saves
DELETE /api/v1/prompts/{id}/saves
```
Used by Dashboard, prompt detail and profile tabs to store user interactions.
### Reviews
@ -210,7 +251,7 @@ PUT /api/v1/prompts/{id}/reviews
}
```
Used for user feedback on prompts.
Used on the prompt detail page. Users can review prompts created by other users. Each user can have one review per prompt; submitting again updates the existing review. Reviews are displayed with username, star rating and comment.
## Categories
@ -240,8 +281,20 @@ Default categories are created automatically when the backend starts.
### Follow or Subscribe to Creator
```http
GET /api/v1/subscriptions/{creatorId}
PUT /api/v1/subscriptions/{creatorId}
DELETE /api/v1/subscriptions/{creatorId}
```
Used by Community to follow or unfollow creators.
Used by Community and public profiles to read follow state, follow creators or unfollow creators.
## Error Handling
Common response codes used by the frontend:
- `200 OK`: request succeeded
- `400 Bad Request`: validation error or invalid request data
- `401 Unauthorized`: user is not logged in and should be redirected to login
- `404 Not Found`: requested prompt, profile or subscription was not found
The frontend handles failed requests with visible error states or redirects to login for unauthorized users.