Skip to content

Commit

Permalink
admin updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kayprogrammer committed Dec 10, 2024
1 parent a6fb04e commit 6a75255
Show file tree
Hide file tree
Showing 15 changed files with 530 additions and 32 deletions.
142 changes: 142 additions & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,148 @@ const docTemplate = `{
"description": "Title of the book to filter by",
"name": "title",
"in": "query"
},
{
"type": "string",
"description": "First name, last name or username of the book author to filter by",
"name": "name",
"in": "query"
},
{
"type": "boolean",
"description": "Filter by highest ratings",
"name": "rating",
"in": "query"
},
{
"type": "string",
"description": "Filter by Genre slug",
"name": "genre_slug",
"in": "query"
},
{
"type": "string",
"description": "Filter by Tag slug",
"name": "tag_slug",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successfully retrieved list of books",
"schema": {
"$ref": "#/definitions/schemas.BooksResponseSchema"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
}
}
}
},
"/admin/books/book-detail/{slug}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint allows an admin to view details of a book",
"tags": [
"Admin | Books"
],
"summary": "View Book Details",
"parameters": [
{
"type": "integer",
"default": 1,
"description": "Current Page (for reviews pagination)",
"name": "page",
"in": "query"
},
{
"type": "string",
"description": "Book slug",
"name": "slug",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/schemas.BookDetailResponseSchema"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
}
}
}
},
"/admin/books/by-username/{username}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieves a list of a particular author books with support for pagination and optional filtering based on book title.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin | Books"
],
"summary": "List Author Books with Pagination",
"parameters": [
{
"type": "string",
"description": "Username of the author",
"name": "username",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "Current Page",
"name": "page",
"in": "query"
},
{
"type": "string",
"description": "Title of the book to filter by",
"name": "title",
"in": "query"
},
{
"type": "boolean",
"description": "Filter by highest ratings",
"name": "rating",
"in": "query"
},
{
"type": "string",
"description": "Filter by Genre slug",
"name": "genre_slug",
"in": "query"
},
{
"type": "string",
"description": "Filter by Tag slug",
"name": "tag_slug",
"in": "query"
}
],
"responses": {
Expand Down
142 changes: 142 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,148 @@
"description": "Title of the book to filter by",
"name": "title",
"in": "query"
},
{
"type": "string",
"description": "First name, last name or username of the book author to filter by",
"name": "name",
"in": "query"
},
{
"type": "boolean",
"description": "Filter by highest ratings",
"name": "rating",
"in": "query"
},
{
"type": "string",
"description": "Filter by Genre slug",
"name": "genre_slug",
"in": "query"
},
{
"type": "string",
"description": "Filter by Tag slug",
"name": "tag_slug",
"in": "query"
}
],
"responses": {
"200": {
"description": "Successfully retrieved list of books",
"schema": {
"$ref": "#/definitions/schemas.BooksResponseSchema"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
}
}
}
},
"/admin/books/book-detail/{slug}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "This endpoint allows an admin to view details of a book",
"tags": [
"Admin | Books"
],
"summary": "View Book Details",
"parameters": [
{
"type": "integer",
"default": 1,
"description": "Current Page (for reviews pagination)",
"name": "page",
"in": "query"
},
{
"type": "string",
"description": "Book slug",
"name": "slug",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/schemas.BookDetailResponseSchema"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/utils.ErrorResponse"
}
}
}
}
},
"/admin/books/by-username/{username}": {
"get": {
"security": [
{
"BearerAuth": []
}
],
"description": "Retrieves a list of a particular author books with support for pagination and optional filtering based on book title.",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin | Books"
],
"summary": "List Author Books with Pagination",
"parameters": [
{
"type": "string",
"description": "Username of the author",
"name": "username",
"in": "path",
"required": true
},
{
"type": "integer",
"default": 1,
"description": "Current Page",
"name": "page",
"in": "query"
},
{
"type": "string",
"description": "Title of the book to filter by",
"name": "title",
"in": "query"
},
{
"type": "boolean",
"description": "Filter by highest ratings",
"name": "rating",
"in": "query"
},
{
"type": "string",
"description": "Filter by Genre slug",
"name": "genre_slug",
"in": "query"
},
{
"type": "string",
"description": "Filter by Tag slug",
"name": "tag_slug",
"in": "query"
}
],
"responses": {
Expand Down
Loading

0 comments on commit 6a75255

Please sign in to comment.