diff --git a/src/swagger.json b/src/swagger.json index 03dd27f..d24457b 100644 --- a/src/swagger.json +++ b/src/swagger.json @@ -71,19 +71,15 @@ } } }, - "security": [ { "bearerAuth": [] } ], "basePath": "/api", - "schemes": [ - "http" - ], - + "schemes": ["http"], "paths": { - "/api/users/register": { + "/users/register": { "post": { "summary": "Create an account", "tags": ["Authentication"], @@ -93,18 +89,9 @@ "schema": { "type": "object", "properties": { - "email": { - "type": "string", - "example": "ishimweamiparadis265@gmail.com" - }, - "password": { - "type": "string", - "example": "12345790003Us*@" - }, - "FullName": { - "type": "string", - "example": "ISHIMWEAIME7@gmail7.com" - } + "email": { "type": "string", "example": "ishimweamiparadis265@gmail.com" }, + "password": { "type": "string", "example": "12345790003Us*@" }, + "FullName": { "type": "string", "example": "ISHIMWEAIME7@gmail7.com" } }, "required": ["email", "password", "FullName"] } @@ -119,15 +106,9 @@ "schema": { "type": "object", "properties": { - "FullName": { - "type": "string" - }, - "email": { - "type": "string" - }, - "password": { - "type": "string" - } + "FullName": { "type": "string" }, + "email": { "type": "string" }, + "password": { "type": "string" } }, "required": ["FullName", "email", "password"] } @@ -140,7 +121,7 @@ } } }, - "/api/users/login": { + "/users/login": { "post": { "summary": "User Login", "tags": ["Authentication"], @@ -150,14 +131,8 @@ "schema": { "type": "object", "properties": { - "email": { - "type": "string", - "example": "ishimweamiparadis265@gmail.com" - }, - "password": { - "type": "string", - "example": "ISHIMWEAIME7@gmail7.com" - } + "email": { "type": "string", "example": "ishimweamiparadis265@gmail.com" }, + "password": { "type": "string", "example": "ISHIMWEAIME7@gmail7.com" } }, "required": ["email", "password"] } @@ -172,26 +147,11 @@ "schema": { "type": "object", "properties": { - "token": { - "type": "string", - "description": "JWT token for authentication" - }, - "type": { - "type": "string", - "description": "Authentication type (e.g., Bearer)" - }, - "fullName": { - "type": "string", - "description": "User's full name" - }, - "email": { - "type": "string", - "description": "User's email address" - }, - "role": { - "type": "string", - "description": "User's role or access level" - } + "token": { "type": "string", "description": "JWT token for authentication" }, + "type": { "type": "string", "description": "Authentication type (e.g., Bearer)" }, + "fullName": { "type": "string", "description": "User's full name" }, + "email": { "type": "string", "description": "User's email address" }, + "role": { "type": "string", "description": "User's role or access level" } } } } @@ -203,13 +163,11 @@ } } }, - "/api/users": { + "/users": { "get": { "summary": "Get all users for the admin panel", "tags": ["Users", "Authentication"], - "parameters": [ - - ], + "parameters": [], "responses": { "200": { "description": "OK" @@ -220,18 +178,11 @@ } } }, - "/api/users/profile": { + "/users/profile": { "get": { "summary": "Get a single user for the admin panel", "tags": ["Users", "Authentication"], - "parameters": [ - { - - "schema": { - "type": "string" - } - } - ], + "parameters": [], "responses": { "200": { "description": "OK" @@ -245,7 +196,7 @@ } } }, - "/api/users/profile/{id}": { + "/users/profile/{id}": { "delete": { "summary": "Delete a certain user by Admin", "tags": ["Users"], @@ -255,9 +206,7 @@ "in": "path", "description": "User ID", "required": true, - "schema": { - "type": "string" - } + "schema": { "type": "string" } } ], "responses": { @@ -273,67 +222,43 @@ } } }, - - - "/api/blogs": { - "post": { - "summary": "Create a blog with valid details", - "tags": ["Blogs"], - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "title": { "type": "string" }, - "desc": { "type": "string" }, - "content": { "type": "string" }, - "file": { "type": "string", "format": "binary" - } - } - } + "/blogs": { + "post": { + "summary": "Create a blog with valid details", + "tags": ["Blogs"], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "title": { "type": "string" }, + "desc": { "type": "string" }, + "content": { "type": "string" }, + "image": { "type": "string", "format": "binary" } } } - }, - "parameters": [ - { - "schema": { "type": "string" } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "data": { - "type": "object", - "properties": { - "title": { "type": "string" }, - "imgsrc": { "type": "string" }, - "desc": { "type": "string" }, - "content": { "type": "string" }, - "user": { "type": "string" } - } - } - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "data": { "type": "object", "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } + "title": { "type": "string" }, + "imgsrc": { "type": "string" }, + "desc": { "type": "string" }, + "content": { "type": "string" }, + "user": { "type": "string" } } } } @@ -341,113 +266,99 @@ } } }, - "get": { - "summary": "Read blogs", - "tags": ["Blogs"], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "data": { - "type": "array", - "items": { - "type": "object", - "properties": { - "title": { "type": "string" }, - "imgsrc": { "type": "string" }, - "desc": { "type": "string" }, - "content": { "type": "string" }, - "user": { "type": "string" } - } - } - } - } - } - } - } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } - } - } + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } } } } } } - }, - "/api/blogs/{id}": { - "get": { - "summary": "Read a single blog", - "tags": ["Blogs"], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "Blog ID", - "required": true, - "schema": { "type": "string" } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "data": { - "type": "object", - "properties": { - "title": { "type": "string" }, - "imgsrc": { "type": "string" }, - "desc": { "type": "string" }, - "content": { "type": "string" }, - "user": { "type": "string" } - } + } + }, + "get": { + "summary": "Read blogs", + "tags": ["Blogs"], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { "type": "string" }, + "imgsrc": { "type": "string" }, + "desc": { "type": "string" }, + "content": { "type": "string" }, + "user": { "type": "string" } } } } } } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } - } - } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } } } - }, - "404": { - "description": "Blog not found", - "content": { - "application/json": { - "schema": { + } + } + } + } + } + }, + "/blogs/{id}": { + "get": { + "summary": "Read a single blog", + "tags": ["Blogs"], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Blog ID", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "data": { "type": "object", "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } + "title": { "type": "string" }, + "imgsrc": { "type": "string" }, + "desc": { "type": "string" }, + "content": { "type": "string" }, + "user": { "type": "string" } } } } @@ -455,71 +366,81 @@ } } }, - "put": { - "summary": "Update a blog", - "tags": ["Blogs"], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "Blog ID", - "required": true, - "schema": { "type": "string" } - }, - { - - "schema": { "type": "string" } - } - ], - "requestBody": { - "required": true, - "content": { - "multipart/form-data": { - "schema": { - "type": "object", - "properties": { - "title": { "type": "string" }, - "desc": { "type": "string" }, - "content": { "type": "string" }, - "image": { "type": "string", "format": "binary" } - } + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } } } } - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "data": { - "type": "object", - "properties": { - "title": { "type": "string" }, - "imgsrc": { "type": "string" }, - "desc": { "type": "string" }, - "content": { "type": "string" }, - "user": { "type": "string" } - } - } - } - } + } + }, + "404": { + "description": "Blog not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } } } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { + } + } + } + } + }, + "put": { + "summary": "Update a blog", + "tags": ["Blogs"], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Blog ID", + "required": true, + "schema": { "type": "string" } + } + ], + "requestBody": { + "required": true, + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "title": { "type": "string" }, + "desc": { "type": "string" }, + "content": { "type": "string" }, + "image": { "type": "string", "format": "binary" } + } + } + } + } + }, + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "data": { "type": "object", "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } + "title": { "type": "string" }, + "imgsrc": { "type": "string" }, + "desc": { "type": "string" }, + "content": { "type": "string" }, + "user": { "type": "string" } } } } @@ -527,100 +448,109 @@ } } }, - "delete": { - "summary": "Delete a blog", - "tags": ["Blogs"], - "parameters": [ - { - "name": "id", - "in": "path", - "description": "Blog ID", - "required": true, - "schema": { "type": "string" } - }, - { - - "schema": { "type": "string" } + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } + } + } } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "data": { "type": "object" } - } - } + } + } + } + }, + "delete": { + "summary": "Delete a blog", + "tags": ["Blogs"], + "parameters": [ + { + "name": "id", + "in": "path", + "description": "Blog ID", + "required": true, + "schema": { "type": "string" } + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "data": { "type": "object" } } } - }, - "400": { - "description": "Bad Request", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } - } - } + } + } + }, + "400": { + "description": "Bad Request", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } } } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } - } - } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } } } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } - } - } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } } } - }, - "404": { - "description": "Blog not found", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "status": { "type": "string" }, - "message": { "type": "string" } - } - } + } + } + }, + "404": { + "description": "Blog not found", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "message": { "type": "string" } } } } } } - }, - - - - "/api/blogs/{id}/comments": { + } + } + }, + "/blogs/{id}/comments": { "post": { "summary": "Add a comment to a blog", "tags": ["Comments"], @@ -658,7 +588,31 @@ }, "responses": { "200": { - "description": "OK" + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "status": { "type": "string" }, + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "commenterName": { "type": "string" }, + "commenterEmail": { "type": "string" }, + "text": { "type": "string" } + } + } + } + } + } + } + } + }, + "400": { + "description": "Bad Request" }, "500": { "description": "Internal server error" @@ -686,18 +640,33 @@ } } }, - "/api/blogs/{id}/likes": { + "/api/queries": { "post": { - "summary": "Add a like to a blog", - "tags": ["Likes"], - "parameters": [ - { - "name": "id", - "in": "path", - "type": "string", - "required": true + "summary": "Create a user query", + "tags": ["Queries"], + "consumes": ["application/json"], + "produces": ["application/json"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "email": { + "type": "string" + }, + "guestQuery": { + "type": "string" + }, + "guestName": { + "type": "string" + } + }, + "required": ["email", "guestQuery", "guestName"] + } + } } - ], + }, "responses": { "200": { "description": "OK" @@ -706,12 +675,25 @@ "description": "Bad Request" } } - } + }, + "get": { + "description": "Getting all messages from users", + "summary": "Read all user queries", + "tags": ["Queries"], + "responses": { + "200": { + "description": "OK" + }, + "400": { + "description": "Bad Request" + } + } + } }, - "/api/blogs/{id}/dislike": { - "post": { - "summary": "Remove like from a blog", - "tags": ["Likes"], + "/api/queries/{id}": { + "get": { + "summary": "Read a single user query", + "tags": ["Queries"], "parameters": [ { "name": "id", @@ -728,12 +710,10 @@ "description": "Bad Request" } } - } - }, - "/api/blogs/{id}/views": { - "post": { - "summary": "Add views to a blog", - "tags": ["Likes"], + }, + "delete": { + "summary": "Delete a user query", + "tags": ["Queries"], "parameters": [ { "name": "id", @@ -752,33 +732,19 @@ } } }, - "/api/queries": { + + "/blogs/{id}/likes": { "post": { - "summary": "Create a user query", - "tags": ["Queries"], - "consumes": ["application/json"], - "produces": ["application/json"], - "requestBody": { - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "email": { - "type": "string" - }, - "guestQuery": { - "type": "string" - }, - "guestName": { - "type": "string" - } - }, - "required": ["email", "guestQuery", "guestName"] - } - } + "summary": "Add a like to a blog", + "tags": ["Likes"], + "parameters": [ + { + "name": "id", + "in": "path", + "type": "string", + "required": true } - }, + ], "responses": { "200": { "description": "OK" @@ -789,12 +755,11 @@ } } }, - "/api/queries/{id}": { - "get": { - "summary": "Read a single user query", - "tags": ["Queries"], + "/blogs/{id}/dislike": { + "post": { + "summary": "Remove like from a blog", + "tags": ["Likes"], "parameters": [ - { "name": "id", "in": "path", @@ -810,12 +775,13 @@ "description": "Bad Request" } } - }, - "delete": { - "summary": "Delete a user query", - "tags": ["Queries"], + } + }, + "/blogs/{id}/views": { + "post": { + "summary": "Add views to a blog", + "tags": ["Likes"], "parameters": [ - { "name": "id", "in": "path", @@ -835,5 +801,3 @@ } } } - -