Skip to content

Commit 6a75255

Browse files
committed
admin updates
1 parent a6fb04e commit 6a75255

File tree

15 files changed

+530
-32
lines changed

15 files changed

+530
-32
lines changed

docs/docs.go

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,148 @@ const docTemplate = `{
5252
"description": "Title of the book to filter by",
5353
"name": "title",
5454
"in": "query"
55+
},
56+
{
57+
"type": "string",
58+
"description": "First name, last name or username of the book author to filter by",
59+
"name": "name",
60+
"in": "query"
61+
},
62+
{
63+
"type": "boolean",
64+
"description": "Filter by highest ratings",
65+
"name": "rating",
66+
"in": "query"
67+
},
68+
{
69+
"type": "string",
70+
"description": "Filter by Genre slug",
71+
"name": "genre_slug",
72+
"in": "query"
73+
},
74+
{
75+
"type": "string",
76+
"description": "Filter by Tag slug",
77+
"name": "tag_slug",
78+
"in": "query"
79+
}
80+
],
81+
"responses": {
82+
"200": {
83+
"description": "Successfully retrieved list of books",
84+
"schema": {
85+
"$ref": "#/definitions/schemas.BooksResponseSchema"
86+
}
87+
},
88+
"500": {
89+
"description": "Internal server error",
90+
"schema": {
91+
"$ref": "#/definitions/utils.ErrorResponse"
92+
}
93+
}
94+
}
95+
}
96+
},
97+
"/admin/books/book-detail/{slug}": {
98+
"get": {
99+
"security": [
100+
{
101+
"BearerAuth": []
102+
}
103+
],
104+
"description": "This endpoint allows an admin to view details of a book",
105+
"tags": [
106+
"Admin | Books"
107+
],
108+
"summary": "View Book Details",
109+
"parameters": [
110+
{
111+
"type": "integer",
112+
"default": 1,
113+
"description": "Current Page (for reviews pagination)",
114+
"name": "page",
115+
"in": "query"
116+
},
117+
{
118+
"type": "string",
119+
"description": "Book slug",
120+
"name": "slug",
121+
"in": "path",
122+
"required": true
123+
}
124+
],
125+
"responses": {
126+
"200": {
127+
"description": "OK",
128+
"schema": {
129+
"$ref": "#/definitions/schemas.BookDetailResponseSchema"
130+
}
131+
},
132+
"400": {
133+
"description": "Bad Request",
134+
"schema": {
135+
"$ref": "#/definitions/utils.ErrorResponse"
136+
}
137+
}
138+
}
139+
}
140+
},
141+
"/admin/books/by-username/{username}": {
142+
"get": {
143+
"security": [
144+
{
145+
"BearerAuth": []
146+
}
147+
],
148+
"description": "Retrieves a list of a particular author books with support for pagination and optional filtering based on book title.",
149+
"consumes": [
150+
"application/json"
151+
],
152+
"produces": [
153+
"application/json"
154+
],
155+
"tags": [
156+
"Admin | Books"
157+
],
158+
"summary": "List Author Books with Pagination",
159+
"parameters": [
160+
{
161+
"type": "string",
162+
"description": "Username of the author",
163+
"name": "username",
164+
"in": "path",
165+
"required": true
166+
},
167+
{
168+
"type": "integer",
169+
"default": 1,
170+
"description": "Current Page",
171+
"name": "page",
172+
"in": "query"
173+
},
174+
{
175+
"type": "string",
176+
"description": "Title of the book to filter by",
177+
"name": "title",
178+
"in": "query"
179+
},
180+
{
181+
"type": "boolean",
182+
"description": "Filter by highest ratings",
183+
"name": "rating",
184+
"in": "query"
185+
},
186+
{
187+
"type": "string",
188+
"description": "Filter by Genre slug",
189+
"name": "genre_slug",
190+
"in": "query"
191+
},
192+
{
193+
"type": "string",
194+
"description": "Filter by Tag slug",
195+
"name": "tag_slug",
196+
"in": "query"
55197
}
56198
],
57199
"responses": {

docs/swagger.json

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,148 @@
4545
"description": "Title of the book to filter by",
4646
"name": "title",
4747
"in": "query"
48+
},
49+
{
50+
"type": "string",
51+
"description": "First name, last name or username of the book author to filter by",
52+
"name": "name",
53+
"in": "query"
54+
},
55+
{
56+
"type": "boolean",
57+
"description": "Filter by highest ratings",
58+
"name": "rating",
59+
"in": "query"
60+
},
61+
{
62+
"type": "string",
63+
"description": "Filter by Genre slug",
64+
"name": "genre_slug",
65+
"in": "query"
66+
},
67+
{
68+
"type": "string",
69+
"description": "Filter by Tag slug",
70+
"name": "tag_slug",
71+
"in": "query"
72+
}
73+
],
74+
"responses": {
75+
"200": {
76+
"description": "Successfully retrieved list of books",
77+
"schema": {
78+
"$ref": "#/definitions/schemas.BooksResponseSchema"
79+
}
80+
},
81+
"500": {
82+
"description": "Internal server error",
83+
"schema": {
84+
"$ref": "#/definitions/utils.ErrorResponse"
85+
}
86+
}
87+
}
88+
}
89+
},
90+
"/admin/books/book-detail/{slug}": {
91+
"get": {
92+
"security": [
93+
{
94+
"BearerAuth": []
95+
}
96+
],
97+
"description": "This endpoint allows an admin to view details of a book",
98+
"tags": [
99+
"Admin | Books"
100+
],
101+
"summary": "View Book Details",
102+
"parameters": [
103+
{
104+
"type": "integer",
105+
"default": 1,
106+
"description": "Current Page (for reviews pagination)",
107+
"name": "page",
108+
"in": "query"
109+
},
110+
{
111+
"type": "string",
112+
"description": "Book slug",
113+
"name": "slug",
114+
"in": "path",
115+
"required": true
116+
}
117+
],
118+
"responses": {
119+
"200": {
120+
"description": "OK",
121+
"schema": {
122+
"$ref": "#/definitions/schemas.BookDetailResponseSchema"
123+
}
124+
},
125+
"400": {
126+
"description": "Bad Request",
127+
"schema": {
128+
"$ref": "#/definitions/utils.ErrorResponse"
129+
}
130+
}
131+
}
132+
}
133+
},
134+
"/admin/books/by-username/{username}": {
135+
"get": {
136+
"security": [
137+
{
138+
"BearerAuth": []
139+
}
140+
],
141+
"description": "Retrieves a list of a particular author books with support for pagination and optional filtering based on book title.",
142+
"consumes": [
143+
"application/json"
144+
],
145+
"produces": [
146+
"application/json"
147+
],
148+
"tags": [
149+
"Admin | Books"
150+
],
151+
"summary": "List Author Books with Pagination",
152+
"parameters": [
153+
{
154+
"type": "string",
155+
"description": "Username of the author",
156+
"name": "username",
157+
"in": "path",
158+
"required": true
159+
},
160+
{
161+
"type": "integer",
162+
"default": 1,
163+
"description": "Current Page",
164+
"name": "page",
165+
"in": "query"
166+
},
167+
{
168+
"type": "string",
169+
"description": "Title of the book to filter by",
170+
"name": "title",
171+
"in": "query"
172+
},
173+
{
174+
"type": "boolean",
175+
"description": "Filter by highest ratings",
176+
"name": "rating",
177+
"in": "query"
178+
},
179+
{
180+
"type": "string",
181+
"description": "Filter by Genre slug",
182+
"name": "genre_slug",
183+
"in": "query"
184+
},
185+
{
186+
"type": "string",
187+
"description": "Filter by Tag slug",
188+
"name": "tag_slug",
189+
"in": "query"
48190
}
49191
],
50192
"responses": {

0 commit comments

Comments
 (0)