Skip to content

Commit

Permalink
Updating schema
Browse files Browse the repository at this point in the history
  • Loading branch information
kadraman committed Oct 9, 2024
1 parent 511b8e6 commit 7605d86
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 51 deletions.
6 changes: 3 additions & 3 deletions etc/IWA-API_development_scan_settings.xml

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions src/configs/swagger_output.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
],
"summary": "Get the site status",
"description": "Get the site message of the day",
"operationId": "getSiteStatus",
"responses": {
"200": {
"description": "Success",
Expand Down Expand Up @@ -87,6 +88,7 @@
],
"summary": "Subscribe a new user",
"description": "Subscribe a new user to the newsletter",
"operationId": "subscribeUser",
"responses": {
"200": {
"description": "Success",
Expand Down Expand Up @@ -168,6 +170,7 @@
],
"summary": "Backup the newsletter database",
"description": "Compress and backup the newsletter database to the specified file",
"operationId": "backupNewsletterDb",
"parameters": [
{
"name": "file_path",
Expand Down Expand Up @@ -234,6 +237,7 @@
],
"summary": "Find users by keyword(s)",
"description": "Gets all existing users searching by %keyword% format",
"operationId": "getUsers",
"parameters": [
{
"name": "keywords",
Expand Down Expand Up @@ -344,6 +348,7 @@
],
"summary": "Create new user",
"description": "Creates a new user",
"operationId": "createUser",
"responses": {
"200": {
"description": "Success",
Expand Down Expand Up @@ -440,6 +445,7 @@
],
"summary": "Get a user",
"description": "Gets an existing user",
"operationId": "getUserById",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -550,6 +556,7 @@
],
"summary": "Update a user",
"description": "Updates an existing user",
"operationId": "updateUser",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -660,6 +667,7 @@
],
"summary": "Delete a user",
"description": "Deletes an existing user",
"operationId": "deleteUser",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -772,6 +780,7 @@
],
"summary": "Get a user using query",
"description": "Gets an existing user using a MongoDb Query",
"operationId": "getUserByQuery",
"parameters": [
{
"name": "q",
Expand Down Expand Up @@ -883,6 +892,7 @@
],
"summary": "Find products by keyword(s)",
"description": "Gets all existing products searching by %keyword% format",
"operationId": "getProducts",
"parameters": [
{
"name": "keywords",
Expand Down Expand Up @@ -963,6 +973,7 @@
],
"summary": "Create new product",
"description": "Creates a new product",
"operationId": "createProduct",
"responses": {
"200": {
"description": "Success",
Expand Down Expand Up @@ -1059,6 +1070,7 @@
],
"summary": "Get a product",
"description": "Gets an existing product",
"operationId": "getProductById",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -1139,6 +1151,7 @@
],
"summary": "Update a product",
"description": "Updates an existing product",
"operationId": "updateProduct",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -1249,6 +1262,7 @@
],
"summary": "Delete a product",
"description": "Deletes an existing product",
"operationId": "deleteProduct",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -1361,6 +1375,7 @@
],
"summary": "Get product image by Id",
"description": "Gets an existing product's image by its Id",
"operationId": "getProductImageById",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -1450,6 +1465,7 @@
],
"summary": "Get product image by name",
"description": "Gets an existing product's image by its uploaded name",
"operationId": "getProductImageByName",
"parameters": [
{
"name": "name",
Expand Down Expand Up @@ -1532,6 +1548,7 @@
],
"summary": "Find messages by keyword(s)",
"description": "Gets all existing messages searching by %keyword% format",
"operationId": "getMessages",
"parameters": [
{
"name": "keywords",
Expand Down Expand Up @@ -1642,6 +1659,7 @@
],
"summary": "Create new message",
"description": "Creates a new message",
"operationId": "createMessage",
"responses": {
"200": {
"description": "Success",
Expand Down Expand Up @@ -1738,6 +1756,7 @@
],
"summary": "Get a message",
"description": "Gets an existing message",
"operationId": "getMessageById",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -1848,6 +1867,7 @@
],
"summary": "Update a message",
"description": "Updates an existing message",
"operationId": "updateMessage",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -1958,6 +1978,7 @@
],
"summary": "Delete a message",
"description": "Deletes an existing message",
"operationId": "deleteMessage",
"parameters": [
{
"name": "id",
Expand Down Expand Up @@ -2070,6 +2091,7 @@
],
"summary": "Get a message using query",
"description": "Gets an existing message using a MongoDb Query",
"operationId": "getMessageByQuery",
"parameters": [
{
"name": "q",
Expand Down
6 changes: 6 additions & 0 deletions src/routes/message.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ messageRoutes.get('/api/v1/messages', AuthorizationHandler.checkJWT, requiredSco
#swagger.tags = ['Messages']
#swagger.summary = "Find messages by keyword(s)"
#swagger.description = "Gets all existing messages searching by %keyword% format"
#swagger.operationId = "getMessages"
#swagger.parameters['keywords'] = {
in: 'query',
description: 'Keyword(s) search for messages to be found.',
Expand Down Expand Up @@ -89,6 +90,7 @@ messageRoutes.get('/api/v1/messages/:id', AuthorizationHandler.checkJWT, require
#swagger.tags = ['Messages']
#swagger.summary = "Get a message"
#swagger.description = "Gets an existing message"
#swagger.operationId = "getMessageById"
#swagger.parameters['id'] = {
description: 'Id of the message to be retrieved. Cannot be empty.'
}
Expand Down Expand Up @@ -125,6 +127,7 @@ messageRoutes.get('/api/v1/message', AuthorizationHandler.checkJWT, requiredScop
#swagger.tags = ['Messages']
#swagger.summary = "Get a message using query"
#swagger.description = "Gets an existing message using a MongoDb Query"
#swagger.operationId = "getMessageByQuery"
#swagger.parameters['q'] = {
description: 'MongoDb query'
}
Expand Down Expand Up @@ -170,6 +173,7 @@ messageRoutes.post('/api/v1/messages', AuthorizationHandler.checkJWT, requiredSc
#swagger.tags = ['Messages']
#swagger.summary = "Create new message"
#swagger.description = "Creates a new message"
#swagger.operationId = "createMessage"
#swagger.requestBody = {
required: true,
content: {
Expand Down Expand Up @@ -209,6 +213,7 @@ messageRoutes.put('/api/v1/messages/:id', AuthorizationHandler.checkJWT, require
#swagger.tags = ['Messages']
#swagger.summary = "Update a message"
#swagger.description = "Updates an existing message"
#swagger.operationId = "updateMessage"
#swagger.parameters['id'] = {
description: 'Id of the message to be updated. Cannot be empty.'
}
Expand Down Expand Up @@ -245,6 +250,7 @@ messageRoutes.delete('/api/v1/messages/:id', AuthorizationHandler.checkJWT, requ
#swagger.tags = ['Messages']
#swagger.summary = "Delete a message"
#swagger.description = "Deletes an existing message"
#swagger.operationId = "deleteMessage"
#swagger.parameters['id'] = {
description: 'Id of the message to be deleted. Cannot be empty.'
}
Expand Down
7 changes: 7 additions & 0 deletions src/routes/product.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ productRoutes.get('/api/v1/products', [AuthorizationHandler.permitAll], (req: Re
#swagger.tags = ['Products']
#swagger.summary = "Find products by keyword(s)"
#swagger.description = "Gets all existing products searching by %keyword% format"
#swagger.operationId = "getProducts"
#swagger.parameters['keywords'] = {
in: 'query',
description: 'Keyword(s) search for products to be found.',
Expand Down Expand Up @@ -70,6 +71,7 @@ productRoutes.get('/api/v1/products/:id', [AuthorizationHandler.permitAll], (req
#swagger.tags = ['Products']
#swagger.summary = "Get a product"
#swagger.description = "Gets an existing product"
#swagger.operationId = "getProductById"
#swagger.parameters['id'] = {
description: 'Id of the product to be retrieved. Cannot be empty.'
}
Expand Down Expand Up @@ -98,6 +100,7 @@ productRoutes.get('/api/v1/products/:id/image', [AuthorizationHandler.permitAll]
#swagger.tags = ['Products']
#swagger.summary = "Get product image by Id"
#swagger.description = "Gets an existing product's image by its Id"
#swagger.operationId = "getProductImageById"
#swagger.parameters['name'] = {
description: 'Id of the product image to be retrieved. Cannot be empty.'
}
Expand Down Expand Up @@ -126,6 +129,7 @@ productRoutes.get('/api/v1/products/:name/image', [AuthorizationHandler.permitAl
#swagger.tags = ['Products']
#swagger.summary = "Get product image by name"
#swagger.description = "Gets an existing product's image by its uploaded name"
#swagger.operationId = "getProductImageByName"
#swagger.parameters['name'] = {
description: 'Name of the product image to be retrieved. Cannot be empty.'
}
Expand Down Expand Up @@ -155,6 +159,7 @@ productRoutes.post('/api/v1/products', AuthorizationHandler.checkJWT, requiredSc
#swagger.tags = ['Products']
#swagger.summary = "Create new product"
#swagger.description = "Creates a new product"
#swagger.operationId = "createProduct"
#swagger.requestBody = {
required: true,
content: {
Expand Down Expand Up @@ -195,6 +200,7 @@ productRoutes.put('/api/v1/products/:id', AuthorizationHandler.checkJWT, require
#swagger.tags = ['Products']
#swagger.summary = "Update a product"
#swagger.description = "Updates an existing product"
#swagger.operationId = "updateProduct"
#swagger.parameters['id'] = {
description: 'Id of the product to be updated. Cannot be empty.'
}
Expand Down Expand Up @@ -231,6 +237,7 @@ productRoutes.delete('/api/v1/products/:id', AuthorizationHandler.checkJWT, requ
#swagger.tags = ['Products']
#swagger.summary = "Delete a product"
#swagger.description = "Deletes an existing product"
#swagger.operationId = "deleteProduct"
#swagger.parameters['id'] = {
description: 'Id of the product to be deleted. Cannot be empty.'
}
Expand Down
99 changes: 51 additions & 48 deletions src/routes/site.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,41 +28,43 @@ export const siteRoutes = Router();

siteRoutes.get('/api/v1/site/status', [AuthorizationHandler.permitAll], (req: Request, res: Response) => {
/*
#swagger.tags = ['Site']
#swagger.summary = "Get the site status"
#swagger.description = "Get the site message of the day"
#swagger.responses[200] = {
description: "Success",
schema: { $ref: '#/components/schemas/success' }
}
#swagger.responses[400] = {
description: "Bad Request",
schema: { $ref: '#/components/schemas/failure' }
}
#swagger.responses[500] = {
description: "Internal Server Error",
schema: { $ref: '#/components/schemas/failure' }
}
#swagger.tags = ['Site']
#swagger.summary = "Get the site status"
#swagger.description = "Get the site message of the day"
#swagger.operationId = "getSiteStatus"
#swagger.responses[200] = {
description: "Success",
schema: { $ref: '#/components/schemas/success' }
}
#swagger.responses[400] = {
description: "Bad Request",
schema: { $ref: '#/components/schemas/failure' }
}
#swagger.responses[500] = {
description: "Internal Server Error",
schema: { $ref: '#/components/schemas/failure' }
}
*/

site_controller.site_status(req, res);
});

siteRoutes.post('/api/v1/site/subscribe-user', [AuthorizationHandler.permitAll], (req: Request, res: Response) => {
/*
#swagger.tags = ['Site']
#swagger.summary = "Subscribe a new user"
#swagger.description = "Subscribe a new user to the newsletter"
#swagger.requestBody = {
required: true,
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/subscribeUser"
}
}
}
}
#swagger.tags = ['Site']
#swagger.summary = "Subscribe a new user"
#swagger.description = "Subscribe a new user to the newsletter"
#swagger.operationId = "subscribeUser"
#swagger.requestBody = {
required: true,
content: {
"application/json": {
schema: {
$ref: "#/components/schemas/subscribeUser"
}
}
}
}
#swagger.responses[200] = {
description: "Success",
schema: { $ref: '#/components/schemas/success' }
Expand All @@ -87,26 +89,27 @@ siteRoutes.post('/api/v1/site/subscribe-user', [AuthorizationHandler.permitAll],
siteRoutes.post('/api/v1/site/backup-newsletter-db', [AuthorizationHandler.permitAll], (req: Request, res: Response) => {

/*
#swagger.tags = ['Site']
#swagger.summary = "Backup the newsletter database"
#swagger.description = "Compress and backup the newsletter database to the specified file"
#swagger.parameters['file_path'] = {
in: 'query',
description: 'The file to backup the database to. Cannot be empty.',
type: 'string'
}
#swagger.responses[200] = {
description: "Success",
schema: { $ref: '#/components/schemas/success' }
}
#swagger.responses[400] = {
description: "Bad Request",
schema: { $ref: '#/components/schemas/failure' }
}
#swagger.responses[500] = {
description: "Internal Server Error",
schema: { $ref: '#/components/schemas/failure' }
}
#swagger.tags = ['Site']
#swagger.summary = "Backup the newsletter database"
#swagger.description = "Compress and backup the newsletter database to the specified file"
#swagger.operationId = "backupNewsletterDb"
#swagger.parameters['file_path'] = {
in: 'query',
description: 'The file to backup the database to. Cannot be empty.',
type: 'string'
}
#swagger.responses[200] = {
description: "Success",
schema: { $ref: '#/components/schemas/success' }
}
#swagger.responses[400] = {
description: "Bad Request",
schema: { $ref: '#/components/schemas/failure' }
}
#swagger.responses[500] = {
description: "Internal Server Error",
schema: { $ref: '#/components/schemas/failure' }
}
*/

site_controller.backup_newsletter_db(req, res);
Expand Down
Loading

0 comments on commit 7605d86

Please sign in to comment.