added ratings and updated ebook struct
This commit is contained in:
@@ -28,6 +28,12 @@ This directory contains Bruno collection for testing the Bookmann API with compr
|
||||
- **Get Reading Progress**: GET /api/ebooks/:id/progress - User's progress
|
||||
- **Update Reading Progress**: PUT /api/ebooks/:id/progress - Update progress
|
||||
|
||||
### Ratings (Protected - JWT Required)
|
||||
- **Get Ebook Rating**: GET /api/ebooks/:id/rating - User's rating for ebook
|
||||
- **Create/Update Rating**: POST /api/ebooks/:id/rating - Rate ebook (1-5 stars)
|
||||
- **Delete Rating**: DELETE /api/ebooks/:id/rating - Remove user's rating
|
||||
- **Get All Ratings**: GET /api/ebooks/:id/ratings - All ratings for ebook
|
||||
|
||||
## Documentation Features
|
||||
|
||||
Each request includes:
|
||||
|
||||
@@ -19,7 +19,14 @@ body:json {
|
||||
"file_path": "/uploads/sample.epub",
|
||||
"file_size": 1024000,
|
||||
"mime_type": "application/epub+zip",
|
||||
"cover_image_path": "/uploads/cover.jpg"
|
||||
"cover_image_path": "/uploads/cover.jpg",
|
||||
"series": "Sample Series",
|
||||
"series_number": 1,
|
||||
"tags": "fiction,adventure",
|
||||
"asin": "B0123456789",
|
||||
"date_published": "2023-01-15",
|
||||
"publisher": "Sample Publisher",
|
||||
"contributors": "Editor Name, Illustrator Name"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,15 +50,22 @@ docs {
|
||||
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Request Body:**
|
||||
- `title` (string, required): Book title
|
||||
- `author` (string, optional): Book author
|
||||
- `isbn` (string, optional): ISBN number
|
||||
- `description` (string, optional): Book description
|
||||
- `file_path` (string, required): Path to ebook file
|
||||
- `file_size` (number, optional): File size in bytes
|
||||
- `mime_type` (string, optional): MIME type
|
||||
- `cover_image_path` (string, optional): Path to cover image
|
||||
**Request Body:**
|
||||
- `title` (string, required): Book title
|
||||
- `author` (string, optional): Book author
|
||||
- `isbn` (string, optional): ISBN number
|
||||
- `description` (string, optional): Book description
|
||||
- `file_path` (string, required): Path to ebook file
|
||||
- `file_size` (number, optional): File size in bytes
|
||||
- `mime_type` (string, optional): MIME type
|
||||
- `cover_image_path` (string, optional): Path to cover image
|
||||
- `series` (string, optional): Book series name
|
||||
- `series_number` (number, optional): Position in series
|
||||
- `tags` (string, optional): Comma-separated tags
|
||||
- `asin` (string, optional): Amazon ASIN
|
||||
- `date_published` (string, optional): Publication date (YYYY-MM-DD)
|
||||
- `publisher` (string, optional): Publisher name
|
||||
- `contributors` (string, optional): Additional contributors
|
||||
|
||||
**Response:** Created ebook object
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
meta {
|
||||
name: Create/Update Ebook Rating
|
||||
type: http
|
||||
seq: 7
|
||||
}
|
||||
|
||||
post {
|
||||
url: http://localhost:8765/api/ebooks/{{ebookid}}/rating
|
||||
body: json
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
body: json {
|
||||
{
|
||||
"rating": 4
|
||||
}
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Create/Update Ebook Rating
|
||||
|
||||
Creates or updates the authenticated user's rating for a specific ebook.
|
||||
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Path Parameters:**
|
||||
- `id` (string): Ebook UUID
|
||||
|
||||
**Request Body:**
|
||||
- `rating` (number, required): Rating value (1-5)
|
||||
|
||||
**Response:**
|
||||
- `id` (string): Rating UUID
|
||||
- `ebook_id` (string): Ebook UUID
|
||||
- `user_id` (string): User UUID
|
||||
- `rating` (number): Rating value (1-5)
|
||||
- `created_at` (string): Creation timestamp
|
||||
- `updated_at` (string): Last update timestamp
|
||||
|
||||
**Error Responses:**
|
||||
- 400: Invalid rating value
|
||||
- 401: Invalid authentication
|
||||
- 404: Ebook not found
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
meta {
|
||||
name: Delete Ebook Rating
|
||||
type: http
|
||||
seq: 8
|
||||
}
|
||||
|
||||
delete {
|
||||
url: http://localhost:8765/api/ebooks/{{ebookid}}/rating
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Delete Ebook Rating
|
||||
|
||||
Deletes the authenticated user's rating for a specific ebook.
|
||||
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Path Parameters:**
|
||||
- `id` (string): Ebook UUID
|
||||
|
||||
**Response:** No content (204)
|
||||
|
||||
**Error Responses:**
|
||||
- 401: Invalid authentication
|
||||
- 404: Rating not found
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
meta {
|
||||
name: Get Ebook Rating
|
||||
type: http
|
||||
seq: 6
|
||||
}
|
||||
|
||||
get {
|
||||
url: http://localhost:8765/api/ebooks/{{ebookid}}/rating
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Get Ebook Rating
|
||||
|
||||
Retrieves the authenticated user's rating for a specific ebook.
|
||||
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Path Parameters:**
|
||||
- `id` (string): Ebook UUID
|
||||
|
||||
**Response:**
|
||||
- `id` (string): Rating UUID
|
||||
- `ebook_id` (string): Ebook UUID
|
||||
- `user_id` (string): User UUID
|
||||
- `rating` (number): Rating value (1-5)
|
||||
- `created_at` (string): Creation timestamp
|
||||
- `updated_at` (string): Last update timestamp
|
||||
|
||||
**Error Responses:**
|
||||
- 401: Invalid authentication
|
||||
- 404: Rating not found
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
meta {
|
||||
name: Get Ebook Ratings
|
||||
type: http
|
||||
seq: 9
|
||||
}
|
||||
|
||||
get {
|
||||
url: http://localhost:8765/api/ebooks/{{ebookid}}/ratings
|
||||
body: none
|
||||
auth: inherit
|
||||
}
|
||||
|
||||
settings {
|
||||
encodeUrl: true
|
||||
timeout: 0
|
||||
}
|
||||
|
||||
docs {
|
||||
## Get Ebook Ratings
|
||||
|
||||
Retrieves all ratings for a specific ebook, including usernames.
|
||||
|
||||
**Authentication:** Required (Bearer token)
|
||||
|
||||
**Path Parameters:**
|
||||
- `id` (string): Ebook UUID
|
||||
|
||||
**Response:** Array of rating objects
|
||||
- `id` (string): Rating UUID
|
||||
- `ebook_id` (string): Ebook UUID
|
||||
- `user_id` (string): User UUID
|
||||
- `rating` (number): Rating value (1-5)
|
||||
- `created_at` (string): Creation timestamp
|
||||
- `updated_at` (string): Last update timestamp
|
||||
- `username` (string): Username of the rating user
|
||||
|
||||
**Error Responses:**
|
||||
- 401: Invalid authentication
|
||||
- 404: Ebook not found
|
||||
}
|
||||
@@ -14,7 +14,14 @@ body:json {
|
||||
{
|
||||
"title": "Updated Book Title",
|
||||
"author": "Updated Author",
|
||||
"description": "Updated description"
|
||||
"description": "Updated description",
|
||||
"series": "Updated Series",
|
||||
"series_number": 2,
|
||||
"tags": "fiction,drama",
|
||||
"asin": "B0987654321",
|
||||
"date_published": "2023-06-15",
|
||||
"publisher": "Updated Publisher",
|
||||
"contributors": "Updated Editor"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,12 +40,19 @@ docs {
|
||||
**Path Parameters:**
|
||||
- `id` (string): Ebook UUID
|
||||
|
||||
**Request Body:** (all fields optional)
|
||||
- `title` (string): Book title
|
||||
- `author` (string): Book author
|
||||
- `isbn` (string): ISBN number
|
||||
- `description` (string): Book description
|
||||
- `cover_image_path` (string): Path to cover image
|
||||
**Request Body:** (all fields optional)
|
||||
- `title` (string): Book title
|
||||
- `author` (string): Book author
|
||||
- `isbn` (string): ISBN number
|
||||
- `description` (string): Book description
|
||||
- `cover_image_path` (string): Path to cover image
|
||||
- `series` (string): Book series name
|
||||
- `series_number` (number): Position in series
|
||||
- `tags` (string): Comma-separated tags
|
||||
- `asin` (string): Amazon ASIN
|
||||
- `date_published` (string): Publication date (YYYY-MM-DD)
|
||||
- `publisher` (string): Publisher name
|
||||
- `contributors` (string): Additional contributors
|
||||
|
||||
**Response:** Updated ebook object
|
||||
|
||||
|
||||
Reference in New Issue
Block a user