Skip to content

Commit 98d66fb

Browse files
committed
admin: genre & tags
1 parent 6b41428 commit 98d66fb

File tree

8 files changed

+830
-8
lines changed

8 files changed

+830
-8
lines changed

docs/docs.go

Lines changed: 247 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const docTemplate = `{
7070
}
7171
}
7272
},
73-
"/admin/contracts": {
73+
"/admin/books/contracts": {
7474
"get": {
7575
"security": [
7676
{
@@ -131,6 +131,224 @@ const docTemplate = `{
131131
}
132132
}
133133
},
134+
"/admin/books/genres": {
135+
"post": {
136+
"security": [
137+
{
138+
"BearerAuth": []
139+
}
140+
],
141+
"description": "Add a new genre to the app.",
142+
"consumes": [
143+
"application/json"
144+
],
145+
"produces": [
146+
"application/json"
147+
],
148+
"tags": [
149+
"Admin | Books"
150+
],
151+
"summary": "Add Genre",
152+
"parameters": [
153+
{
154+
"description": "Genre",
155+
"name": "data",
156+
"in": "body",
157+
"required": true,
158+
"schema": {
159+
"$ref": "#/definitions/schemas.GenreAddSchema"
160+
}
161+
}
162+
],
163+
"responses": {
164+
"201": {
165+
"description": "Genre Added Successfully",
166+
"schema": {
167+
"$ref": "#/definitions/schemas.ResponseSchema"
168+
}
169+
},
170+
"400": {
171+
"description": "Invalid request data",
172+
"schema": {
173+
"$ref": "#/definitions/utils.ErrorResponse"
174+
}
175+
},
176+
"500": {
177+
"description": "Internal server error",
178+
"schema": {
179+
"$ref": "#/definitions/utils.ErrorResponse"
180+
}
181+
}
182+
}
183+
}
184+
},
185+
"/admin/books/genres/{slug}": {
186+
"put": {
187+
"security": [
188+
{
189+
"BearerAuth": []
190+
}
191+
],
192+
"description": "Update a genre.",
193+
"consumes": [
194+
"application/json"
195+
],
196+
"produces": [
197+
"application/json"
198+
],
199+
"tags": [
200+
"Admin | Books"
201+
],
202+
"summary": "Update Genre",
203+
"parameters": [
204+
{
205+
"type": "string",
206+
"description": "Genre slug",
207+
"name": "slug",
208+
"in": "path",
209+
"required": true
210+
},
211+
{
212+
"description": "Genre",
213+
"name": "data",
214+
"in": "body",
215+
"required": true,
216+
"schema": {
217+
"$ref": "#/definitions/schemas.GenreAddSchema"
218+
}
219+
}
220+
],
221+
"responses": {
222+
"200": {
223+
"description": "Genre Updated Successfully",
224+
"schema": {
225+
"$ref": "#/definitions/schemas.ResponseSchema"
226+
}
227+
},
228+
"400": {
229+
"description": "Invalid request data",
230+
"schema": {
231+
"$ref": "#/definitions/utils.ErrorResponse"
232+
}
233+
},
234+
"500": {
235+
"description": "Internal server error",
236+
"schema": {
237+
"$ref": "#/definitions/utils.ErrorResponse"
238+
}
239+
}
240+
}
241+
}
242+
},
243+
"/admin/books/tags": {
244+
"post": {
245+
"security": [
246+
{
247+
"BearerAuth": []
248+
}
249+
],
250+
"description": "Add a new tag to the app.",
251+
"consumes": [
252+
"application/json"
253+
],
254+
"produces": [
255+
"application/json"
256+
],
257+
"tags": [
258+
"Admin | Books"
259+
],
260+
"summary": "Add Tags",
261+
"parameters": [
262+
{
263+
"description": "Tag",
264+
"name": "data",
265+
"in": "body",
266+
"required": true,
267+
"schema": {
268+
"$ref": "#/definitions/schemas.TagsAddSchema"
269+
}
270+
}
271+
],
272+
"responses": {
273+
"201": {
274+
"description": "Tag added successfully",
275+
"schema": {
276+
"$ref": "#/definitions/schemas.ResponseSchema"
277+
}
278+
},
279+
"400": {
280+
"description": "Invalid request data",
281+
"schema": {
282+
"$ref": "#/definitions/utils.ErrorResponse"
283+
}
284+
},
285+
"500": {
286+
"description": "Internal server error",
287+
"schema": {
288+
"$ref": "#/definitions/utils.ErrorResponse"
289+
}
290+
}
291+
}
292+
}
293+
},
294+
"/admin/books/tags/{slug}": {
295+
"put": {
296+
"security": [
297+
{
298+
"BearerAuth": []
299+
}
300+
],
301+
"description": "Update a tag to the app.",
302+
"consumes": [
303+
"application/json"
304+
],
305+
"produces": [
306+
"application/json"
307+
],
308+
"tags": [
309+
"Admin | Books"
310+
],
311+
"summary": "Update Tags",
312+
"parameters": [
313+
{
314+
"type": "string",
315+
"description": "Tag slug",
316+
"name": "slug",
317+
"in": "path",
318+
"required": true
319+
},
320+
{
321+
"description": "Tag",
322+
"name": "data",
323+
"in": "body",
324+
"required": true,
325+
"schema": {
326+
"$ref": "#/definitions/schemas.TagsAddSchema"
327+
}
328+
}
329+
],
330+
"responses": {
331+
"200": {
332+
"description": "Tag updated successfully",
333+
"schema": {
334+
"$ref": "#/definitions/schemas.ResponseSchema"
335+
}
336+
},
337+
"400": {
338+
"description": "Invalid request data",
339+
"schema": {
340+
"$ref": "#/definitions/utils.ErrorResponse"
341+
}
342+
},
343+
"500": {
344+
"description": "Internal server error",
345+
"schema": {
346+
"$ref": "#/definitions/utils.ErrorResponse"
347+
}
348+
}
349+
}
350+
}
351+
},
134352
"/admin/payments/transactions": {
135353
"get": {
136354
"security": [
@@ -3565,6 +3783,23 @@ const docTemplate = `{
35653783
}
35663784
}
35673785
},
3786+
"schemas.GenreAddSchema": {
3787+
"type": "object",
3788+
"required": [
3789+
"name"
3790+
],
3791+
"properties": {
3792+
"name": {
3793+
"type": "string"
3794+
},
3795+
"tag_slugs": {
3796+
"type": "array",
3797+
"items": {
3798+
"type": "string"
3799+
}
3800+
}
3801+
}
3802+
},
35683803
"schemas.GenreSchema": {
35693804
"type": "object",
35703805
"properties": {
@@ -4298,6 +4533,17 @@ const docTemplate = `{
42984533
}
42994534
}
43004535
},
4536+
"schemas.TagsAddSchema": {
4537+
"type": "object",
4538+
"required": [
4539+
"name"
4540+
],
4541+
"properties": {
4542+
"name": {
4543+
"type": "string"
4544+
}
4545+
}
4546+
},
43014547
"schemas.TagsResponseSchema": {
43024548
"type": "object",
43034549
"properties": {

0 commit comments

Comments
 (0)