From 805267fdbe4d5af987f0ac8a2718764f3279cb15 Mon Sep 17 00:00:00 2001 From: its-me-yps Date: Sun, 7 Jan 2024 21:14:47 +0530 Subject: [PATCH] Adding Post req JSON format --- docs/dist.json | 568 +++++++++++++++++- openapi/components/responses/response.yaml | 6 + .../components/schemas/admin/user/new.yaml | 17 + .../components/schemas/users/login/first.yaml | 16 + .../components/schemas/users/sendheart.yaml | 29 + .../schemas/users/sendheartVirtual.yaml | 41 ++ openapi/openapi.yaml | 2 +- openapi/paths/admin/user/delete.yaml | 20 +- openapi/paths/admin/user/new.yaml | 11 +- openapi/paths/session/admin/login.yaml | 16 +- openapi/paths/session/login.yaml | 16 +- openapi/paths/users/claimheart.yaml | 18 +- openapi/paths/users/login/first.yaml | 11 +- openapi/paths/users/mail:id.yaml | 12 +- openapi/paths/users/publish.yaml | 12 +- openapi/paths/users/sendheart.yaml | 11 +- openapi/paths/users/sendheartVirtual.yaml | 11 +- openapi/paths/users/sentHeartDecoded.yaml | 21 +- .../users/special/returnclaimedheartlate.yaml | 21 +- openapi/paths/users/verifyreturnhearts.yaml | 16 +- 20 files changed, 846 insertions(+), 29 deletions(-) create mode 100644 openapi/components/responses/response.yaml create mode 100644 openapi/components/schemas/admin/user/new.yaml create mode 100644 openapi/components/schemas/users/login/first.yaml create mode 100644 openapi/components/schemas/users/sendheart.yaml create mode 100644 openapi/components/schemas/users/sendheartVirtual.yaml diff --git a/docs/dist.json b/docs/dist.json index fa6244c..baf2e1c 100644 --- a/docs/dist.json +++ b/docs/dist.json @@ -45,7 +45,30 @@ ], "summary": "Mail Authentication Code", "description": "Receive the exact message you've sent", - "operationId": "mail" + "operationId": "mail", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": {} + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/users/login/first": { @@ -55,7 +78,29 @@ ], "summary": "Register User", "description": "Receive the exact message you've sent", - "operationId": "register" + "operationId": "register", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/first" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/session/login": { @@ -66,7 +111,37 @@ ], "summary": "User Login", "description": "Receive the exact message you've sent", - "operationId": "userLogin" + "operationId": "userLogin", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "_id": { + "type": "string" + }, + "passHash": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/session/logout": { @@ -89,7 +164,37 @@ ], "summary": "Admin Login", "description": "Receive the exact message you've sent", - "operationId": "adminLogin" + "operationId": "adminLogin", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "pass": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/admin/user/deleteallusers": { @@ -109,7 +214,29 @@ ], "summary": "Add New Users", "description": "Receive the exact message you've sent", - "operationId": "newUsers" + "operationId": "newUsers", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/new" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/admin/user/delete": { @@ -119,7 +246,43 @@ ], "summary": "Delete User", "description": "Receive the exact message you've sent", - "operationId": "delete" + "operationId": "delete", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "roll": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "gender": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/admin/publish": { @@ -184,7 +347,29 @@ ], "summary": "Save User Selections", "description": "Receive the exact message you've sent", - "operationId": "sendHeartsVirtual" + "operationId": "sendHeartsVirtual", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/sendheartVirtual" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/users/sendheart": { @@ -195,7 +380,29 @@ ], "summary": "Send Hearts", "description": "Receive the exact message you've sent", - "operationId": "sendHearts" + "operationId": "sendHearts", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/sendheart" + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/users/claimheart": { @@ -206,7 +413,40 @@ ], "summary": "Claim from send_hearts Table", "description": "Receive the exact message you've sent", - "operationId": "claimHeart" + "operationId": "claimHeart", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "sha": { + "type": "string" + }, + "genderOfSender": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/users/verifyreturnhearts": { @@ -217,7 +457,37 @@ ], "summary": "Matching", "description": "Receive the exact message you've sent", - "operationId": "matching" + "operationId": "matching", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "secret": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/users/sentHeartDecoded": { @@ -227,17 +497,93 @@ ], "summary": "Gender Wise Heart Count", "description": "Receive the exact message you've sent", - "operationId": "heartCount" + "operationId": "heartCount", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "decodedHearts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "genderOfSender": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, - "/users/special/returnclaimedheartlate": { + "/special/returnclaimedheartlate": { "post": { "tags": [ "User" ], "summary": "Returning claim in return_hearts Table", "description": "Receive the exact message you've sent", - "operationId": "late" + "operationId": "late", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "returnhearts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "sha": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/users/publish": { @@ -247,7 +593,30 @@ ], "summary": "User Permission to Publish his/her result", "description": "Receive the exact message you've sent", - "operationId": "permisssion" + "operationId": "permisssion", + "requestBody": { + "description": null, + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": {} + } + } + } + }, + "responses": { + "200": { + "description": "Successful response" + }, + "400": { + "description": "Bad request" + }, + "500": { + "description": "Internal server error" + } + } } }, "/users/mymatches": { @@ -261,5 +630,174 @@ } } }, - "components": {} + "components": { + "schemas": { + "first": { + "type": "object", + "properties": { + "roll": { + "type": "string" + }, + "authCode": { + "type": "string" + }, + "passHash": { + "type": "string" + }, + "pubKey": { + "type": "string" + }, + "privKey": { + "type": "string" + }, + "data": { + "type": "string", + "enum": [ + "FIRST_LOGIN" + ] + } + } + }, + "new": { + "type": "object", + "properties": { + "newuser": { + "type": "array", + "items": { + "type": "object", + "properties": { + "roll": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "gender": { + "type": "string" + }, + "passHash": { + "type": "string" + } + } + } + } + } + }, + "sendheartVirtual": { + "type": "object", + "properties": { + "hearts": { + "type": "object", + "properties": { + "heart1": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "sha": { + "type": "string" + }, + "id_encrypt": { + "type": "string" + } + } + }, + "heart2": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "sha": { + "type": "string" + }, + "id_encrypt": { + "type": "string" + } + } + }, + "heart3": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "sha": { + "type": "string" + }, + "id_encrypt": { + "type": "string" + } + } + }, + "heart4": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "sha": { + "type": "string" + }, + "id_encrypt": { + "type": "string" + } + } + } + } + } + } + }, + "sendheart": { + "type": "object", + "properties": { + "genderofsender": { + "type": "string" + }, + "enc1": { + "type": "string" + }, + "sha1": { + "type": "string" + }, + "enc2": { + "type": "string" + }, + "sha2": { + "type": "string" + }, + "enc3": { + "type": "string" + }, + "sha3": { + "type": "string" + }, + "enc4": { + "type": "string" + }, + "sha4": { + "type": "string" + }, + "returnhearts": { + "type": "array", + "items": { + "type": "object", + "properties": { + "enc": { + "type": "string" + }, + "sha": { + "type": "string" + } + } + } + } + } + } + } + } } \ No newline at end of file diff --git a/openapi/components/responses/response.yaml b/openapi/components/responses/response.yaml new file mode 100644 index 0000000..722b8e1 --- /dev/null +++ b/openapi/components/responses/response.yaml @@ -0,0 +1,6 @@ +'200': + description: Successful response +'400': + description: Bad request +'500': + description: Internal server error \ No newline at end of file diff --git a/openapi/components/schemas/admin/user/new.yaml b/openapi/components/schemas/admin/user/new.yaml new file mode 100644 index 0000000..4686a0f --- /dev/null +++ b/openapi/components/schemas/admin/user/new.yaml @@ -0,0 +1,17 @@ +type: object +properties: + newuser: + type: array + items: + type: object + properties: + roll: + type: string + name: + type: string + email: + type: string + gender: + type: string + passHash: + type: string \ No newline at end of file diff --git a/openapi/components/schemas/users/login/first.yaml b/openapi/components/schemas/users/login/first.yaml new file mode 100644 index 0000000..4d88f9d --- /dev/null +++ b/openapi/components/schemas/users/login/first.yaml @@ -0,0 +1,16 @@ +type: object +properties: + roll: + type: string + authCode: + type: string + passHash: + type: string + pubKey: + type: string + privKey: + type: string + data: + type: string + enum: + - FIRST_LOGIN \ No newline at end of file diff --git a/openapi/components/schemas/users/sendheart.yaml b/openapi/components/schemas/users/sendheart.yaml new file mode 100644 index 0000000..d8d18df --- /dev/null +++ b/openapi/components/schemas/users/sendheart.yaml @@ -0,0 +1,29 @@ +type: object +properties: + genderofsender: + type: string + enc1: + type: string + sha1: + type: string + enc2: + type: string + sha2: + type: string + enc3: + type: string + sha3: + type: string + enc4: + type: string + sha4: + type: string + returnhearts: + type: array + items: + type: object + properties: + enc: + type: string + sha: + type: string \ No newline at end of file diff --git a/openapi/components/schemas/users/sendheartVirtual.yaml b/openapi/components/schemas/users/sendheartVirtual.yaml new file mode 100644 index 0000000..4bac23f --- /dev/null +++ b/openapi/components/schemas/users/sendheartVirtual.yaml @@ -0,0 +1,41 @@ +type: object +properties: + hearts: + type: object + properties: + heart1: + type: object + properties: + enc: + type: string + sha: + type: string + id_encrypt: + type: string + heart2: + type: object + properties: + enc: + type: string + sha: + type: string + id_encrypt: + type: string + heart3: + type: object + properties: + enc: + type: string + sha: + type: string + id_encrypt: + type: string + heart4: + type: object + properties: + enc: + type: string + sha: + type: string + id_encrypt: + type: string \ No newline at end of file diff --git a/openapi/openapi.yaml b/openapi/openapi.yaml index f243db3..b92aa66 100644 --- a/openapi/openapi.yaml +++ b/openapi/openapi.yaml @@ -58,7 +58,7 @@ paths: $ref: paths/users/verifyreturnhearts.yaml /users/sentHeartDecoded: $ref: paths/users/sentHeartDecoded.yaml - /users/special/returnclaimedheartlate: + /special/returnclaimedheartlate: $ref: paths/users/special/returnclaimedheartlate.yaml /users/publish: $ref: paths/users/publish.yaml diff --git a/openapi/paths/admin/user/delete.yaml b/openapi/paths/admin/user/delete.yaml index 40f9c7c..db05f27 100644 --- a/openapi/paths/admin/user/delete.yaml +++ b/openapi/paths/admin/user/delete.yaml @@ -3,4 +3,22 @@ post: - Admin summary: Delete User description: Receive the exact message you've sent - operationId: delete \ No newline at end of file + operationId: delete + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: + roll: + type: string + name: + type: string + email: + type: string + gender: + type: string + responses: + $ref: ../../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/admin/user/new.yaml b/openapi/paths/admin/user/new.yaml index 48da6ec..8b9231a 100644 --- a/openapi/paths/admin/user/new.yaml +++ b/openapi/paths/admin/user/new.yaml @@ -3,4 +3,13 @@ post: - Admin summary: Add New Users description: Receive the exact message you've sent - operationId: newUsers \ No newline at end of file + operationId: newUsers + requestBody: + description: + required: true + content: + application/json: + schema: + $ref: ../../../components/schemas/admin/user/new.yaml + responses: + $ref: ../../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/session/admin/login.yaml b/openapi/paths/session/admin/login.yaml index 2fed48d..ba06d2a 100644 --- a/openapi/paths/session/admin/login.yaml +++ b/openapi/paths/session/admin/login.yaml @@ -4,4 +4,18 @@ post: - Session summary: Admin Login description: Receive the exact message you've sent - operationId: adminLogin \ No newline at end of file + operationId: adminLogin + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: + id: + type: string + pass: + type: string + responses: + $ref: ../../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/session/login.yaml b/openapi/paths/session/login.yaml index b8ef566..93be312 100644 --- a/openapi/paths/session/login.yaml +++ b/openapi/paths/session/login.yaml @@ -4,4 +4,18 @@ post: - Session summary: User Login description: Receive the exact message you've sent - operationId: userLogin \ No newline at end of file + operationId: userLogin + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: + _id: + type: string + passHash: + type: string + responses: + $ref: ../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/claimheart.yaml b/openapi/paths/users/claimheart.yaml index 4f3dd32..9c0d40e 100644 --- a/openapi/paths/users/claimheart.yaml +++ b/openapi/paths/users/claimheart.yaml @@ -4,4 +4,20 @@ post: - Verify summary: Claim from send_hearts Table description: Receive the exact message you've sent - operationId: claimHeart \ No newline at end of file + operationId: claimHeart + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: + enc: + type: string + sha: + type: string + genderOfSender: + type: string + responses: + $ref: ../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/login/first.yaml b/openapi/paths/users/login/first.yaml index 2dd1425..d245efd 100644 --- a/openapi/paths/users/login/first.yaml +++ b/openapi/paths/users/login/first.yaml @@ -3,4 +3,13 @@ post: - User summary: Register User description: Receive the exact message you've sent - operationId: register \ No newline at end of file + operationId: register + requestBody: + description: + required: true + content: + application/json: + schema: + $ref: ../../../components/schemas/users/login/first.yaml + responses: + $ref: ../../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/mail:id.yaml b/openapi/paths/users/mail:id.yaml index d4f5378..ecd694b 100644 --- a/openapi/paths/users/mail:id.yaml +++ b/openapi/paths/users/mail:id.yaml @@ -3,4 +3,14 @@ post: - User summary: Mail Authentication Code description: Receive the exact message you've sent - operationId: mail \ No newline at end of file + operationId: mail + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: {} + responses: + $ref: ../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/publish.yaml b/openapi/paths/users/publish.yaml index 748c0c8..b2953fb 100644 --- a/openapi/paths/users/publish.yaml +++ b/openapi/paths/users/publish.yaml @@ -3,4 +3,14 @@ post: - User summary: User Permission to Publish his/her result description: Receive the exact message you've sent - operationId: permisssion \ No newline at end of file + operationId: permisssion + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: {} + responses: + $ref: ../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/sendheart.yaml b/openapi/paths/users/sendheart.yaml index e57af0e..8e7f4ae 100644 --- a/openapi/paths/users/sendheart.yaml +++ b/openapi/paths/users/sendheart.yaml @@ -4,4 +4,13 @@ post: - Send summary: Send Hearts description: Receive the exact message you've sent - operationId: sendHearts \ No newline at end of file + operationId: sendHearts + requestBody: + description: + required: true + content: + application/json: + schema: + $ref: ../../components/schemas/users/sendheart.yaml + responses: + $ref: ../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/sendheartVirtual.yaml b/openapi/paths/users/sendheartVirtual.yaml index 320c898..de07036 100644 --- a/openapi/paths/users/sendheartVirtual.yaml +++ b/openapi/paths/users/sendheartVirtual.yaml @@ -4,4 +4,13 @@ post: - Send summary: Save User Selections description: Receive the exact message you've sent - operationId: sendHeartsVirtual \ No newline at end of file + operationId: sendHeartsVirtual + requestBody: + description: + required: true + content: + application/json: + schema: + $ref: ../../components/schemas/users/sendheartVirtual.yaml + responses: + $ref: ../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/sentHeartDecoded.yaml b/openapi/paths/users/sentHeartDecoded.yaml index b5d1481..ef97ded 100644 --- a/openapi/paths/users/sentHeartDecoded.yaml +++ b/openapi/paths/users/sentHeartDecoded.yaml @@ -3,4 +3,23 @@ post: - User summary: Gender Wise Heart Count description: Receive the exact message you've sent - operationId: heartCount \ No newline at end of file + operationId: heartCount + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: + decodedHearts: + type: array + items: + type: object + properties: + enc: + type: string + genderOfSender: + type: string + responses: + $ref: ../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/special/returnclaimedheartlate.yaml b/openapi/paths/users/special/returnclaimedheartlate.yaml index 5bfe681..5d0c6ae 100644 --- a/openapi/paths/users/special/returnclaimedheartlate.yaml +++ b/openapi/paths/users/special/returnclaimedheartlate.yaml @@ -3,4 +3,23 @@ post: - User summary: Returning claim in return_hearts Table description: Receive the exact message you've sent - operationId: late \ No newline at end of file + operationId: late + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: + returnhearts: + type: array + items: + type: object + properties: + enc: + type: string + sha: + type: string + responses: + $ref: ../../../components/responses/response.yaml \ No newline at end of file diff --git a/openapi/paths/users/verifyreturnhearts.yaml b/openapi/paths/users/verifyreturnhearts.yaml index 11f7661..5038f1d 100644 --- a/openapi/paths/users/verifyreturnhearts.yaml +++ b/openapi/paths/users/verifyreturnhearts.yaml @@ -4,4 +4,18 @@ post: - Verify summary: Matching description: Receive the exact message you've sent - operationId: matching \ No newline at end of file + operationId: matching + requestBody: + description: + required: true + content: + application/json: + schema: + type: object + properties: + enc: + type: string + secret: + type: string + responses: + $ref: ../../components/responses/response.yaml \ No newline at end of file