diff --git a/.eslintrc b/.eslintrc index ee1d2c9f..37638623 100644 --- a/.eslintrc +++ b/.eslintrc @@ -3,7 +3,31 @@ "rules": { "@next/next/no-img-element": "off", "react/no-unknown-property": "error" + }, + //...your configuration + "overrides": [ + //...your overrides + { + // Force the setting of a swagger description on each api endpoint + "files": ["pages/api/**/*.js"], + "plugins": ["jsdoc"], + "rules": { + "jsdoc/no-missing-syntax": [ + "error", + { + "contexts": [ + { + "comment": "JsdocBlock:has(JsdocTag[tag=swagger])", + "context": "any", + "message": "@swagger documentation is required on each API. Check this out for syntax info: https://github.com/jellydn/next-swagger-doc" + } + ] + } + ] + } } + ] + } diff --git a/actions/index.js b/actions/index.js index b5e97169..b37476b1 100644 --- a/actions/index.js +++ b/actions/index.js @@ -1333,6 +1333,19 @@ export const uploadRepFiles = async ( }; export const getFilesFromBlob = (containerName, casefolderID) => { + console.log( + BASE_URL + + "/api/file/getbloblist?container=" + + containerName + + "&casefolderID=" + + casefolderID + + hashAPIPath( + "/api/file/getbloblist?container=" + + containerName + + "&casefolderID=" + + casefolderID + ) + ); return axios .get( BASE_URL + @@ -1462,6 +1475,13 @@ export const sendEmail = async ( "personalisation": personalisation, }; + console.log( + "hwewwew: ", + templateId, + emailAddress, + personalisation, + reference + ); var queryUrl = "/api/email/notify"; var config = { diff --git a/next-swagger-doc.json b/next-swagger-doc.json index 02c3e2a7..b8a717fa 100644 --- a/next-swagger-doc.json +++ b/next-swagger-doc.json @@ -4,10 +4,585 @@ "models" ], "definition": { - "openapi": "3.0.0", + "openapi": "3.0.3", "info": { - "title": "Next Swagger API Example", + "title": "PEDW API", "version": "1.0" - } + }, + "components": { + "schemas": { + "emailBody": { + "type": "object", + "properties": { + "reference": { + "type": "string", + "example": "PEDW-COMPLETE" + }, + "templateId": { + "type": "string", + "example": "618e0463-b092-4733-a024-bf8a3bbde808" + }, + "emailAddress": { + "type": "string", + "example": "rob@rdbtech.co.uk" + }, + "personalisation": { + "type": "object", + "example": { + "caseReference": "CAS-TEST-TEST", + "emailAddress": "rob@rdbtech.co.uk", + "linkExpiry": "10 * 60" + } + } + } + } + }, + "securitySchemes": { + "pedw_auth": { + "type": "oauth2", + "flows": { + "clientCredentials": { + "tokenUrl": "https://login.microsoftonline.com/9ac1a5ab-cd58-409e-a1b6-6b10422a68f5/oauth2/v2.0/token", + "scopes": "https://dev-pedw-ns.servicebus.windows.net/.default" + } + } + }, + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + } + } + }, + "paths": { + "/api/auth/[...nextauth]": { + "get": { + "tags": [ + "Login" + ], + "description": "NextAuth", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/documents/download/{id}": { + "get": { + "tags": [ + "Documents" + ], + "description": "Get document", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "iShare ID", + "type": "string", + "required": true, + "default": "A41567436" + }, + { + "name": "hash", + "in": "query", + "description": "Hash string", + "default": "e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71" + } + ], + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/email/notify": { + "post": { + "tags": [ + "Email" + ], + "summary": "Email to user", + "consumes": [ + "application/json" + ], + "description": "Send email via gov notify", + "produces": [ + "application/json", + "application/xml" + ], + "requestBody": { + "name": "Email", + "description": "Email body", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/emailBody" + } + } + } + }, + "responses": { + "405": { + "description": "Failed" + } + } + } + }, + "/api/endpoint/createaccount_api": { + "post": { + "tags": [ + "Account" + ], + "description": "Create password", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/createcase_api": { + "post": { + "tags": [ + "Case" + ], + "description": "Create case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/createmywatchedcases_api": { + "post": { + "tags": [ + "Portal", + "Case" + ], + "description": "Create my watched cases", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteawaitingsubmissions_api": { + "delete": { + "tags": [ + "Case" + ], + "description": "Delete awaiting case submission", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteamyrepresentations_api": { + "delete": { + "tags": [ + "Portal", + "Representations" + ], + "description": "Delete my representations", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteamywatchedcases_api": { + "delete": { + "tags": [ + "Portal", + "Case" + ], + "description": "Delete my watched cases", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getadvancedsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Advanced search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getadvancedsearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Advanced search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealid_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal ID", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealtypes_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal Types", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealtypesfornewappeal_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal Types for appeal", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getawaitingsubmission_api": { + "get": { + "tags": [ + "Case" + ], + "description": "get awaiting case submission", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getawaitingsubmissionproxy_api": { + "get": { + "tags": [ + "Case" + ], + "description": "get awaiting case submission proxy", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchdetails_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnsurlsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search URL", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchdetails_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getcase_api": { + "get": { + "tags": [ + "Case" + ], + "summary": "Not used", + "description": "Get case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getlogin_api": { + "get": { + "tags": [ + "Login" + ], + "description": "Returns the hello world", + "responses": { + "200": { + "description": "hello world" + } + } + } + }, + "/api/endpoint/getlpa_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Get list of LPA's", + "responses": { + "200": { + "description": "Success" + } + }, + "security": [ + { + "relay_auth": [] + } + ] + } + }, + "/api/endpoint/getsearchdocumentdetails_api": { + "get": { + "tags": [ + "Search", + "Documents" + ], + "description": "Basic search documents details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumentdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumenthistory_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumenthistorypaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumentTypes_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/patchcase_api": { + "patch": { + "tags": [ + "Case" + ], + "description": "Patch case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updateaccount_api": { + "patch": { + "tags": [ + "Account" + ], + "description": "Update account", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updatecase_api": { + "patch": { + "tags": [ + "Case" + ], + "description": "Update case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updatepassword_api": { + "patch": { + "tags": [ + "Account" + ], + "description": "Update password", + "responses": { + "200": { + "description": "Success" + } + } + } + } + }, + "tags": [] } } \ No newline at end of file diff --git a/package.json b/package.json index e1037b2d..419eaf46 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "redux-thunk": "^2.4.2", "sass": "1.32", "sass-loader": "13.2.0", + "swagger-ui": "^4.17.1", "swagger-ui-react": "^4.17.0", "typescript": "^4.9.5", "uuid": "9.0.0", @@ -73,6 +74,7 @@ "devDependencies": { "eslint": "^8.6.0", "eslint-config-next": "^13.1.6", + "eslint-plugin-jsdoc": "^40.0.1", "prisma": "^3.12.0" } } diff --git a/pages/api-doc.js b/pages/api-doc.js new file mode 100644 index 00000000..0649622b --- /dev/null +++ b/pages/api-doc.js @@ -0,0 +1,102 @@ +import { createSwaggerSpec } from "next-swagger-doc"; +import dynamic from "next/dynamic"; +import "swagger-ui-react/swagger-ui.css"; + +const SwaggerUI = dynamic(import("swagger-ui-react"), { ssr: false }); + +function ApiDoc({ spec }) { + return ; +} + +let BASE_URL; +const port = parseInt(process.env.PORT, 10) || 3000; + +if (process.browser) { + BASE_URL = window.apiRoot; +} else { + BASE_URL = process.env.API_ROOT || `http://localhost:${port}`; +} +const WORDKEY = process.env.HASHKEY; + +const cache = {}; +const API_PATH = "/api/data/v8.2/"; + +const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT; +const tenantId = process.env.TENANT; + +export const getStaticProps = async () => { + const spec = createSwaggerSpec({ + layout: "StandaloneLayout", + apiFolder: "pages/api", + schemaFolders: ["models"], + definition: { + openapi: "3.0.3", + info: { + title: "PEDW API", + version: "1.0", + contact: { + email: "rob@rdbsolutions.co.uk", + }, + }, + docExpansion: "none", + components: { + schemas: { + emailBody: { + type: "object", + properties: { + reference: { + type: "string", + example: "PEDW-COMPLETE", + }, + templateId: { + type: "string", + example: "618e0463-b092-4733-a024-bf8a3bbde808", + }, + emailAddress: { + type: "string", + example: "rob@rdbtech.co.uk", + }, + personalisation: { + type: "object", + example: { + caseReference: "CAS-TEST-TEST", + emailAddress: "rob@rdbtech.co.uk", + linkExpiry: "10 * 60", + }, + }, + }, + }, + }, + // securitySchemes: { + // pedw_auth: { + // type: "oauth2", + // flows: { + // clientCredentials: { + // tokenUrl: `${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`, + // scopes: + // "https://" + + // process.env.RELAYURI + + // "/.default", + // }, + // }, + // }, + // api_key: { + // type: "apiKey", + // name: "api_key", + // in: "header", + // }, + // }, + }, + }, + }); + + //console.log(JSON.stringify(spec)); + + return { + props: { + spec, + }, + }; +}; + +export default ApiDoc; diff --git a/pages/api-doc.tsx b/pages/api-doc.tsx deleted file mode 100644 index 5981cd6d..00000000 --- a/pages/api-doc.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { GetStaticProps, InferGetStaticPropsType } from 'next'; -import { createSwaggerSpec } from 'next-swagger-doc'; -import dynamic from 'next/dynamic'; -import 'swagger-ui-react/swagger-ui.css'; - -const SwaggerUI = dynamic<{ - spec: any; -}>(import('swagger-ui-react'), { ssr: false }); - -function ApiDoc({ spec }: InferGetStaticPropsType) { - return ; -} - -export const getStaticProps: GetStaticProps = async () => { - const spec: Record = createSwaggerSpec({ - - definition: { - openapi: '3.0.0', - info: { - title: 'PEDW API', - description: "something here", - version: '1.0', - }, - }, - }); - - return { - props: { - spec, - }, - }; -}; - -export default ApiDoc; \ No newline at end of file diff --git a/pages/api/auth/[...nextauth].js b/pages/api/auth/[...nextauth].js index 4fc6da6b..e0648c67 100644 --- a/pages/api/auth/[...nextauth].js +++ b/pages/api/auth/[...nextauth].js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/auth/[...nextauth]: + * get: + * tags: [Login] + * description: NextAuth + * responses: + * 200: + * description: Success + */ + import NextAuth from "next-auth"; import EmailProvider from "next-auth/providers/email"; import { PrismaAdapter } from "@next-auth/prisma-adapter"; diff --git a/pages/api/doc.ts b/pages/api/doc.ts index 06781292..9054f053 100644 --- a/pages/api/doc.ts +++ b/pages/api/doc.ts @@ -4,10 +4,10 @@ const swaggerHandler = withSwagger({ definition: { openapi: '3.0.0', info: { - title: 'NextJS Swagger', + title: 'PEDW Example', version: '0.1.0', }, }, - apiFolder: 'pages/api', + schemaFolders: ['models'], }); export default swaggerHandler(); \ No newline at end of file diff --git a/pages/api/documents/download/[id].js b/pages/api/documents/download/[id].js index f0a0a2ea..355af41a 100644 --- a/pages/api/documents/download/[id].js +++ b/pages/api/documents/download/[id].js @@ -11,11 +11,11 @@ * description: iShare ID * type: string * required: true - * default: A21852159 + * default: A41567436 * - name: hash * in: query - * description: Hashe stirng - * default: 25d7ae78acb551d9e051b98fc425ebee9b201ba203afe4fc9d330e2b7895e072 + * description: Hash string + * default: e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71 * responses: * 200: * description: Success diff --git a/pages/api/email/notify.js b/pages/api/email/notify.js index 0fb1d41b..891e90df 100644 --- a/pages/api/email/notify.js +++ b/pages/api/email/notify.js @@ -1,13 +1,28 @@ /** * @swagger * /api/email/notify: - * get: + * post: * tags: * - Email + * summary: Email to user + * consumes: + * - application/json * description: Send email via gov notify + * produces: [ + * "application/json", + * "application/xml" + * ] + * requestBody: + * name: Email + * description: Email body + * required: true + * content: + * 'application/json': + * schema: + * $ref: "#/components/schemas/emailBody" * responses: - * 200: - * description: Success + * 405: + * description: Failed */ import { consoleLogger } from "../../../actions"; @@ -20,7 +35,7 @@ export default async function ApiProxy(req, res) { const notifyClient = new NotifyClient(process.env.NOTIFY_API_KEY); //const emailReplyToId = process.env.EMAIL_REPLY_TO_ID; - console.log("///////////////\n Sending email \ns//////////////"); + console.log("///////////////\n Sending email \ns//////////////", data); notifyClient .sendEmail(data.templateId, data.emailAddress, { @@ -29,7 +44,7 @@ export default async function ApiProxy(req, res) { // emailReplyToId: emailReplyToId, }) .then((response) => { - //console.log("thisis the response", response); + console.log("thisis the response", response); return res.status(200).json(data); }) .catch((err) => { diff --git a/pages/api/endpoint/createaccount_api.js b/pages/api/endpoint/createaccount_api.js index f9ff3067..79ffa9e2 100644 --- a/pages/api/endpoint/createaccount_api.js +++ b/pages/api/endpoint/createaccount_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/createaccount_api: + * post: + * tags: [Account] + * description: Create password + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/createcase_api.js b/pages/api/endpoint/createcase_api.js index 59c13bf4..438cfe7f 100644 --- a/pages/api/endpoint/createcase_api.js +++ b/pages/api/endpoint/createcase_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/createcase_api: + * post: + * tags: [Case] + * description: Create case + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/createwatchedcases_api.js b/pages/api/endpoint/createwatchedcases_api.js index b17e4f97..0525e796 100644 --- a/pages/api/endpoint/createwatchedcases_api.js +++ b/pages/api/endpoint/createwatchedcases_api.js @@ -1,8 +1,13 @@ -import axios from "axios"; -import CryptoJS from "crypto-js"; -import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; - -const WORDKEY = process.env.HASHKEY; +/** + * @swagger + * /api/endpoint/createmywatchedcases_api: + * post: + * tags: [Portal,Case] + * description: Create my watched cases + * responses: + * 200: + * description: Success + */ const WEBAPI_URL = process.env.RELAY_ROOT || diff --git a/pages/api/endpoint/deleteawaitingsubmissions_api.js b/pages/api/endpoint/deleteawaitingsubmissions_api.js index d56bc4ad..37530ead 100644 --- a/pages/api/endpoint/deleteawaitingsubmissions_api.js +++ b/pages/api/endpoint/deleteawaitingsubmissions_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/deleteawaitingsubmissions_api: + * delete: + * tags: [Case] + * description: Delete awaiting case submission + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/deletemyrepresentations_api.js b/pages/api/endpoint/deletemyrepresentations_api.js index 3efd9f69..7fb5872d 100644 --- a/pages/api/endpoint/deletemyrepresentations_api.js +++ b/pages/api/endpoint/deletemyrepresentations_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/deleteamyrepresentations_api: + * delete: + * tags: [Portal,Representations] + * description: Delete my representations + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/deletewatchedcases_api.js b/pages/api/endpoint/deletewatchedcases_api.js index 5ba1abef..73ac01ef 100644 --- a/pages/api/endpoint/deletewatchedcases_api.js +++ b/pages/api/endpoint/deletewatchedcases_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/deleteamywatchedcases_api: + * delete: + * tags: [Portal,Case] + * description: Delete my watched cases + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getToken.js b/pages/api/endpoint/getToken.js new file mode 100644 index 00000000..9e2f6ca2 --- /dev/null +++ b/pages/api/endpoint/getToken.js @@ -0,0 +1,53 @@ +/** + * @swagger + * /api/endpoint/getToken: + * post: + * tags: [Login] + * summary: Not used + * description: Get case + * parameters: + * - name: client_id + * in: requestbody + * responses: + * 200: + * description: Success + */ +import axios from "axios"; + +export default async function ApiProxy(req, res) { + const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT; + const tenantId = process.env.TENANT; + const tokenBody = + "grant_type=" + + process.env.GRANT_TYPE + + "&client_id=" + + process.env.CLIENT_ID + + "&client_secret=" + + process.env.CLIENT_SECRET + + "&scope=" + + "https://" + + process.env.RELAYURI + + "/.default"; + + var config = { + method: "post", + headers: { + "Content-Type": "application/x-www-form-urlencoded", + "Cache-Control": "no-cache", + }, + url: `${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`, + body: tokenBody, + }; + + console.log("get token case:", config); + + return axios + .post(`${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`, tokenBody) + .then(({ data }) => { + console.log; + res.status(200).json(data); + }) + .catch((error) => { + res.status(400); + }); +} diff --git a/pages/api/endpoint/getadvancedsearch_api.js b/pages/api/endpoint/getadvancedsearch_api.js index 9a44a228..2f9fbc90 100644 --- a/pages/api/endpoint/getadvancedsearch_api.js +++ b/pages/api/endpoint/getadvancedsearch_api.js @@ -1,3 +1,26 @@ +/** + * @swagger + * /api/endpoint/getadvancedsearch_api: + * get: + * tags: [Search] + * description: Advanced search + * parameters: + * - name: searchstring + * description: search string + * in: query + * required: false + * example: { + * "q":"cas-", + * "lpa":"744c69f4-48da-eb11-aac5-00224800be9c", + * "apt":"846040000", + * "statuscode":"1"} + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; @@ -55,14 +78,14 @@ export default async function ApiProxy(req, res) { ? " statuscode eq " + searchString.statuscode + " and" : ""; - console.log(queryString); + //console.log(queryString); var queryUrl = "incidents?$select=description,numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" + queryString + " pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true"; - console.log(queryUrl); + //console.log(queryString, "\n", queryUrl); var apiResponse = _.isEmpty(searchString) ? res.status(400).json() diff --git a/pages/api/endpoint/getadvancedsearchpaged_api.js b/pages/api/endpoint/getadvancedsearchpaged_api.js index 46176f74..2e577775 100644 --- a/pages/api/endpoint/getadvancedsearchpaged_api.js +++ b/pages/api/endpoint/getadvancedsearchpaged_api.js @@ -1,3 +1,52 @@ +/** + * @swagger + * /api/endpoint/getadvancedsearchpaged_api: + * get: + * tags: [Search] + * description: Advanced search paged + * parameters: + * - name: searchstring + * description: search string + * in: query + * required: false + * example: { + * "q":"cas-", + * "lpa":"744c69f4-48da-eb11-aac5-00224800be9c", + * "apt":"846040000", + * "statuscode":"1"} + * schema: + * type: string + * - name: pageNumber + * in: query + * required: true + * example: 1 + * schema: + * type: string + * - name: orderby + * in: query + * required: true + * example: createdon + * schema: + * type: string + * - name: fieldSort + * in: query + * required: true + * description: asc or desc + * example: asc + * schema: + * type: string + * - name: showNumberOfRecords + * in: query + * required: true + * description: number of records to return per page + * example: 10 + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { query } from "jsonpath"; diff --git a/pages/api/endpoint/getappealid_api.js b/pages/api/endpoint/getappealid_api.js index 4317372c..71838a12 100644 --- a/pages/api/endpoint/getappealid_api.js +++ b/pages/api/endpoint/getappealid_api.js @@ -1,3 +1,33 @@ +/** + * @swagger + * /api/endpoint/getappealid_api: + * get: + * tags: [Misc] + * description: Get Appeal ID from + * parameters: + * - name: caseReference + * in: query + * required: true + * example: CAS-00764-L0Q9W2 + * schema: + * type: string + * - name: updateFormCollection + * in: query + * required: true + * example: pinswg_planningappeals78s + * schema: + * type: string + * - name: primaryAttribute + * in: query + * required: true + * example: pinswg_planningappeals78id + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getappealtypes_api.js b/pages/api/endpoint/getappealtypes_api.js index 3718ff3c..22f34f65 100644 --- a/pages/api/endpoint/getappealtypes_api.js +++ b/pages/api/endpoint/getappealtypes_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/getappealtypes_api: + * get: + * tags: [Misc] + * description: Get Appeal Types + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { diff --git a/pages/api/endpoint/getappealtypesfornewappeal_api.js b/pages/api/endpoint/getappealtypesfornewappeal_api.js index 2b561553..3960af97 100644 --- a/pages/api/endpoint/getappealtypesfornewappeal_api.js +++ b/pages/api/endpoint/getappealtypesfornewappeal_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/getappealtypesfornewappeal_api: + * get: + * tags: [Misc] + * description: Get Appeal Types for appeal + * responses: + * 200: + * description: Success + */ + const ApiResponse = (req, res) => { res.statusCode = 200; res.json({ diff --git a/pages/api/endpoint/getawaitingsubmission_api.js b/pages/api/endpoint/getawaitingsubmission_api.js index 3cf3a4b1..69e4209f 100644 --- a/pages/api/endpoint/getawaitingsubmission_api.js +++ b/pages/api/endpoint/getawaitingsubmission_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/getawaitingsubmission_api: + * get: + * tags: [Case] + * description: get awaiting case submission + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getawaitingsubmissionproxy_api.js b/pages/api/endpoint/getawaitingsubmissionproxy_api.js index 2c11fe3e..ed7d5fc0 100644 --- a/pages/api/endpoint/getawaitingsubmissionproxy_api.js +++ b/pages/api/endpoint/getawaitingsubmissionproxy_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/getawaitingsubmissionproxy_api: + * get: + * tags: [Case] + * description: get awaiting case submission proxy + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getbasicdnssearch_api.js b/pages/api/endpoint/getbasicdnssearch_api.js index d42a9fb3..127d987d 100644 --- a/pages/api/endpoint/getbasicdnssearch_api.js +++ b/pages/api/endpoint/getbasicdnssearch_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getbasicdnssearch_api: + * get: + * tags: [Search,] + * description: Basic DNS search + * parameters: + * - name: searchString + * in: query + * required: true + * example: farm + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getbasicdnssearchdetails_api.js b/pages/api/endpoint/getbasicdnssearchdetails_api.js index 017445bd..b33737f7 100644 --- a/pages/api/endpoint/getbasicdnssearchdetails_api.js +++ b/pages/api/endpoint/getbasicdnssearchdetails_api.js @@ -1,3 +1,15 @@ +/** + * @swagger + * /api/endpoint/getbasicdnssearchdetails_api: + * get: + * tags: [Search] + * summary: Not used + * description: Basic DNS search details + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getbasicdnssearchdetailspaged_api.js b/pages/api/endpoint/getbasicdnssearchdetailspaged_api.js index b0b9c0bc..0f6c9889 100644 --- a/pages/api/endpoint/getbasicdnssearchdetailspaged_api.js +++ b/pages/api/endpoint/getbasicdnssearchdetailspaged_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/getbasicdnssearchdetailspaged_api: + * get: + * tags: [Search] + * description: Basic DNS search details paged + * summary: Not used + * responses: + * 200: + * description: Success + */ import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getbasicdnssearchpaged_api.js b/pages/api/endpoint/getbasicdnssearchpaged_api.js index b983bfba..f17dbf5e 100644 --- a/pages/api/endpoint/getbasicdnssearchpaged_api.js +++ b/pages/api/endpoint/getbasicdnssearchpaged_api.js @@ -1,3 +1,47 @@ +/** + * @swagger + * /api/endpoint/getbasicdnssearchpaged_api: + * get: + * tags: [Search] + * description: Basic DNS search paged + * parameters: + * - name: searchString + * in: query + * required: true + * example: farm + * schema: + * type: string + * - name: pageNumber + * in: query + * required: true + * example: 1 + * schema: + * type: string + * - name: orderby + * in: query + * required: true + * example: createdon + * schema: + * type: string + * - name: fieldSort + * in: query + * required: true + * description: asc or desc + * example: asc + * schema: + * type: string + * - name: showNumberOfRecords + * in: query + * required: true + * description: number of records to return per page + * example: 10 + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getbasicdnsurlsearch_api.js b/pages/api/endpoint/getbasicdnsurlsearch_api.js index 418f9f6f..836080b7 100644 --- a/pages/api/endpoint/getbasicdnsurlsearch_api.js +++ b/pages/api/endpoint/getbasicdnsurlsearch_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getbasicdnsurlsearch_api: + * get: + * tags: [Search] + * description: Basic DNS search URL + * parameters: + * - name: searchString + * in: query + * required: true + * example: farm + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getbasicsearch_api.js b/pages/api/endpoint/getbasicsearch_api.js index 0e7c4b12..ffb17f0b 100644 --- a/pages/api/endpoint/getbasicsearch_api.js +++ b/pages/api/endpoint/getbasicsearch_api.js @@ -1,3 +1,20 @@ +/** + * @swagger + * /api/endpoint/getbasicsearch_api: + * get: + * tags: [Search] + * description: Basic search + * parameters: + * - name: searchString + * in: query + * required: true + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getbasicsearchdetails_api.js b/pages/api/endpoint/getbasicsearchdetails_api.js index e524b57c..0567fafa 100644 --- a/pages/api/endpoint/getbasicsearchdetails_api.js +++ b/pages/api/endpoint/getbasicsearchdetails_api.js @@ -1,3 +1,34 @@ +/** + * @swagger + * /api/endpoint/getbasicsearchdetails_api: + * get: + * tags: [Search] + * description: Basic search details + * parameters: + * - name: appealTypeName + * description: + * in: query + * required: true + * example: pinswg_planningappeals78s + * schema: + * type: string + * - name: primaryIdAttribute + * in: query + * required: true + * example: pinswg_planningappeals78id + * schema: + * type: string + * - name: incidentID + * in: query + * required: true + * example: 1f129091-cb0f-ec11-aac8-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getbasicsearchdetailspaged_api.js b/pages/api/endpoint/getbasicsearchdetailspaged_api.js index 57a1389e..21020a5b 100644 --- a/pages/api/endpoint/getbasicsearchdetailspaged_api.js +++ b/pages/api/endpoint/getbasicsearchdetailspaged_api.js @@ -1,3 +1,34 @@ +/** + * @swagger + * /api/endpoint/getbasicsearchdetailspaged_api: + * get: + * tags: [Search] + * description: Basic search details + * parameters: + * - name: appealTypeName + * description: + * in: query + * required: true + * example: pinswg_planningappeals78s + * schema: + * type: string + * - name: primaryIdAttribute + * in: query + * required: true + * example: pinswg_planningappeals78id + * schema: + * type: string + * - name: incidentID + * in: query + * required: true + * example: 1f129091-cb0f-ec11-aac8-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getbasicsearchpaged_api.js b/pages/api/endpoint/getbasicsearchpaged_api.js index 1396d762..32e40894 100644 --- a/pages/api/endpoint/getbasicsearchpaged_api.js +++ b/pages/api/endpoint/getbasicsearchpaged_api.js @@ -1,7 +1,55 @@ +/** + * @swagger + * /api/endpoint/getbasicsearchpaged_api: + * get: + * tags: [Search] + * description: Basic search paged + * parameters: + * - name: searchString + * in: query + * required: true + * example: cas- + * schema: + * type: string + * - name: pageNumber + * in: query + * required: true + * example: 2 + * schema: + * type: string + * - name: orderby + * in: query + * required: true + * example: createdon + * schema: + * type: string + * - name: fieldSort + * in: query + * required: true + * description: asc or desc + * example: asc + * schema: + * type: string + * - name: showNumberOfRecords + * in: query + * required: true + * description: number of records to return per page + * example: 10 + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; -import { getToken, azureHeadersPagedCustom } from "../../../actions"; +import { + getToken, + azureHeadersPagedCustom, + consoleLogger, +} from "../../../actions"; const WORDKEY = process.env.HASHKEY; @@ -42,7 +90,7 @@ export default async function ApiProxy(req, res) { ? "&$skiptoken=" + '' : ""); - //console.log("basic search paged:", queryUrl); + console.log("basic search paged:", queryUrl); var apiResponse = searchString.length > 0 diff --git a/pages/api/endpoint/getcase_api.js b/pages/api/endpoint/getcase_api.js index 11f92b68..1d1f2202 100644 --- a/pages/api/endpoint/getcase_api.js +++ b/pages/api/endpoint/getcase_api.js @@ -1,3 +1,15 @@ +/** + * @swagger + * /api/endpoint/getcase_api: + * get: + * tags: [Case] + * summary: Not used + * description: Get case + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getlinkedcases_api.js b/pages/api/endpoint/getlinkedcases_api.js index 9b7a0f23..4424f628 100644 --- a/pages/api/endpoint/getlinkedcases_api.js +++ b/pages/api/endpoint/getlinkedcases_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getlinkedcases_api: + * get: + * tags: [Case] + * description: Get linked cases + * parameters: + * - name: parentincidentid + * in: query + * required: true + * example: 53a37b9e-1dfc-eb11-aac7-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getlogin_api.js b/pages/api/endpoint/getlogin_api.js index f73bca5c..bad265c7 100644 --- a/pages/api/endpoint/getlogin_api.js +++ b/pages/api/endpoint/getlogin_api.js @@ -4,6 +4,17 @@ * get: * tags: [Login] * description: Returns the hello world + * parameters: + * - name: emailaddress + * in: query + * required: true + * schema: + * type: string + * - name: pwd + * in: query + * required: true + * schema: + * type: string * responses: * 200: * description: hello world diff --git a/pages/api/endpoint/getlpa_api.js b/pages/api/endpoint/getlpa_api.js index e831a211..d39f3aee 100644 --- a/pages/api/endpoint/getlpa_api.js +++ b/pages/api/endpoint/getlpa_api.js @@ -7,6 +7,9 @@ * responses: * 200: * description: Success + * security: + * - relay_auth: [] + * */ import axios from "axios"; diff --git a/pages/api/endpoint/getmycases_api.js b/pages/api/endpoint/getmycases_api.js index 35212e7e..0e23bf3a 100644 --- a/pages/api/endpoint/getmycases_api.js +++ b/pages/api/endpoint/getmycases_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getmycases_api: + * get: + * tags: [Portal] + * description: Get My Cases + * parameters: + * - name: loggedInUserId + * in: query + * required: true + * example: 726158c6-708d-ec11-aad8-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getmyrepresentations_api.js b/pages/api/endpoint/getmyrepresentations_api.js index 2ca5b293..55c60120 100644 --- a/pages/api/endpoint/getmyrepresentations_api.js +++ b/pages/api/endpoint/getmyrepresentations_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getmyrepresentations_api: + * get: + * tags: [Portal] + * description: Get My representations + * parameters: + * - name: loggedInUserId + * in: query + * required: true + * example: 726158c6-708d-ec11-aad8-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getmyrepresentationsproxy_api.js b/pages/api/endpoint/getmyrepresentationsproxy_api.js index 635f0ed3..f85c7d92 100644 --- a/pages/api/endpoint/getmyrepresentationsproxy_api.js +++ b/pages/api/endpoint/getmyrepresentationsproxy_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getmyrepresentationsproxy_api: + * get: + * tags: [Portal] + * description: Get My representations + * parameters: + * - name: loggedInUserId + * in: query + * required: true + * example: 726158c6-708d-ec11-aad8-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getpersonalaccount_api.js b/pages/api/endpoint/getpersonalaccount_api.js index 94a87bc8..0584be9d 100644 --- a/pages/api/endpoint/getpersonalaccount_api.js +++ b/pages/api/endpoint/getpersonalaccount_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getpersonalaccount_api: + * get: + * tags: [Account] + * description: Get personal account + * parameters: + * - name: contactid + * in: query + * required: true + * example: 726158c6-708d-ec11-aad8-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: hello world + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getportallogin_api.js b/pages/api/endpoint/getportallogin_api.js index a4653bbe..11e3d70c 100644 --- a/pages/api/endpoint/getportallogin_api.js +++ b/pages/api/endpoint/getportallogin_api.js @@ -1,3 +1,20 @@ +/** + * @swagger + * /api/endpoint/getportallogin_api: + * get: + * tags: [Login] + * description: Returns portal login + * parameters: + * - name: emailaddress + * in: query + * required: true + * schema: + * type: string + * responses: + * 200: + * description: hello world + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getportalmoduledetails_api.js b/pages/api/endpoint/getportalmoduledetails_api.js index 4445f074..54a16944 100644 --- a/pages/api/endpoint/getportalmoduledetails_api.js +++ b/pages/api/endpoint/getportalmoduledetails_api.js @@ -1,3 +1,27 @@ +/** + * @swagger + * /api/endpoint/getportalmoduledetails_api: + * get: + * tags: [Portal] + * description: Get portal module details + * parameters: + * - name: appealType + * in: query + * required: true + * example: pinswg_planningappeals78s + * schema: + * type: string + * - name: caseReference + * in: query + * required: true + * example: CAS-00764-L0Q9W2 + * schema: + * type: string + * responses: + * 200: + * description: hello world + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; @@ -23,7 +47,7 @@ export default async function ApiProxy(req, res) { var caseReference = req.query.caseReference.split("'").join("''"); var token = await getToken(); - //console.log("the case:", req.query, caseReference); + console.log("the case:", req.query, caseReference); var queryUrl = appealType + diff --git a/pages/api/endpoint/getportalmoduledetailsproxy_api.js b/pages/api/endpoint/getportalmoduledetailsproxy_api.js index 41b79c67..b1ac5547 100644 --- a/pages/api/endpoint/getportalmoduledetailsproxy_api.js +++ b/pages/api/endpoint/getportalmoduledetailsproxy_api.js @@ -1,3 +1,27 @@ +/** + * @swagger + * /api/endpoint/getportalmoduledetailsproxy_api: + * get: + * tags: [Portal] + * description: Get portal module details proxy + * parameters: + * - name: appealType + * in: query + * required: true + * example: pinswg_planningappeals78s + * schema: + * type: string + * - name: caseReference + * in: query + * required: true + * example: CAS-00764-L0Q9W2 + * schema: + * type: string + * responses: + * 200: + * description: hello world + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getrepresentations_api.js b/pages/api/endpoint/getrepresentations_api.js index 2a3e0234..290fb97d 100644 --- a/pages/api/endpoint/getrepresentations_api.js +++ b/pages/api/endpoint/getrepresentations_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getrepresentations_api: + * get: + * tags: [Case] + * description: Get Representations for a Case + * parameters: + * - name: incidentID + * in: query + * required: true + * example: 50b533aa-43f1-ec11-aade-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; @@ -19,6 +37,7 @@ const hashAPIPath = (queryPath) => { export default async function ApiProxy(req, res) { var loggedInUserId = req.query.loggedInUserId; + var incidentID = req.query.incidentID; var token = await getToken(); var queryUrl = diff --git a/pages/api/endpoint/getrepresentationsproxy_api.js b/pages/api/endpoint/getrepresentationsproxy_api.js index e120e308..408a6402 100644 --- a/pages/api/endpoint/getrepresentationsproxy_api.js +++ b/pages/api/endpoint/getrepresentationsproxy_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getrepresentationsproxy_api: + * get: + * tags: [Case] + * description: Get Representations for a Case + * parameters: + * - name: incidentID + * in: query + * required: true + * example: 50b533aa-43f1-ec11-aade-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeaders, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getsearchdocumentTypes_api.js b/pages/api/endpoint/getsearchdocumentTypes_api.js index c5cb6b2c..f30fbbec 100644 --- a/pages/api/endpoint/getsearchdocumentTypes_api.js +++ b/pages/api/endpoint/getsearchdocumentTypes_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getsearchdocumentTypes_api: + * get: + * tags: [Search,] + * description: Returns types of documents for a case + * parameters: + * - name: incidentid + * in: query + * required: true + * example: 50b533aa-43f1-ec11-aade-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getsearchdocumentdetails_api.js b/pages/api/endpoint/getsearchdocumentdetails_api.js index 8122fa3d..e2f8fce4 100644 --- a/pages/api/endpoint/getsearchdocumentdetails_api.js +++ b/pages/api/endpoint/getsearchdocumentdetails_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getsearchdocumentdetails_api: + * get: + * tags: [Search,Documents] + * description: Basic search documents details + * parameters: + * - name: incidentid + * in: query + * required: true + * example: 50b533aa-43f1-ec11-aade-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getsearchdocumentdetailspaged_api.js b/pages/api/endpoint/getsearchdocumentdetailspaged_api.js index 5eb4d312..8b3517e6 100644 --- a/pages/api/endpoint/getsearchdocumentdetailspaged_api.js +++ b/pages/api/endpoint/getsearchdocumentdetailspaged_api.js @@ -1,3 +1,47 @@ +/** + * @swagger + * /api/endpoint/getsearchdocumentdetailspaged_api: + * get: + * tags: [Search,] + * description: Basic search documents details paged + * parameters: + * - name: incidentid + * in: query + * required: true + * example: 50b533aa-43f1-ec11-aade-00224800be9c + * schema: + * type: string + * - name: pageNumber + * in: query + * required: true + * example: 1 + * schema: + * type: string + * - name: orderby + * in: query + * required: true + * example: createdon + * schema: + * type: string + * - name: fieldSort + * in: query + * required: true + * description: asc or desc + * example: asc + * schema: + * type: string + * - name: showNumberOfRecords + * in: query + * required: true + * description: number of records to return per page + * example: 10 + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/getsearchdocumenthistory_api.js b/pages/api/endpoint/getsearchdocumenthistory_api.js index a2e7566d..e042f105 100644 --- a/pages/api/endpoint/getsearchdocumenthistory_api.js +++ b/pages/api/endpoint/getsearchdocumenthistory_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getsearchdocumenthistory_api: + * get: + * tags: [Search,] + * description: Basic search documents history + * parameters: + * - name: documentid + * in: query + * required: true + * example: e09d7297-2a13-ed11-aadf-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getsearchdocumenthistorypaged_api.js b/pages/api/endpoint/getsearchdocumenthistorypaged_api.js index 5c20554b..246d5c30 100644 --- a/pages/api/endpoint/getsearchdocumenthistorypaged_api.js +++ b/pages/api/endpoint/getsearchdocumenthistorypaged_api.js @@ -1,3 +1,47 @@ +/** + * @swagger + * /api/endpoint/getsearchdocumenthistorypaged_api: + * get: + * tags: [Search,] + * description: Basic search documents history paged + * parameters: + * - name: documentid + * in: query + * required: true + * example: e09d7297-2a13-ed11-aadf-00224800be9c + * schema: + * type: string + * - name: pageNumber + * in: query + * required: true + * example: 1 + * schema: + * type: string + * - name: orderby + * in: query + * required: true + * example: createdon + * schema: + * type: string + * - name: fieldSort + * in: query + * required: true + * description: asc or desc + * example: asc + * schema: + * type: string + * - name: showNumberOfRecords + * in: query + * required: true + * description: number of records to return per page + * example: 10 + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, azureHeadersPaged, consoleLogger } from "../../../actions"; diff --git a/pages/api/endpoint/getwatchedcases_api.js b/pages/api/endpoint/getwatchedcases_api.js index 12bd0269..5a277835 100644 --- a/pages/api/endpoint/getwatchedcases_api.js +++ b/pages/api/endpoint/getwatchedcases_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getwatchedcases_api: + * get: + * tags: [Portal] + * description: Get my watched cases s + * parameters: + * - name: loggedInUserId + * in: query + * required: true + * example: 726158c6-708d-ec11-aad8-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { diff --git a/pages/api/endpoint/getwatchedcasesproxy_api.js b/pages/api/endpoint/getwatchedcasesproxy_api.js index 9505f281..9d63adb0 100644 --- a/pages/api/endpoint/getwatchedcasesproxy_api.js +++ b/pages/api/endpoint/getwatchedcasesproxy_api.js @@ -1,3 +1,21 @@ +/** + * @swagger + * /api/endpoint/getwatchedcasesproxy_api: + * get: + * tags: [Portal] + * description: Get my watched cases s + * parameters: + * - name: loggedInUserId + * in: query + * required: true + * example: 726158c6-708d-ec11-aad8-00224800be9c + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { azureHeaders, getToken } from "../../../actions"; diff --git a/pages/api/endpoint/patchcase_api.js b/pages/api/endpoint/patchcase_api.js index 6ae5e8fb..daed9e26 100644 --- a/pages/api/endpoint/patchcase_api.js +++ b/pages/api/endpoint/patchcase_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/patchcase_api: + * patch: + * tags: [Case] + * description: Patch case + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import _ from "lodash"; diff --git a/pages/api/endpoint/updateaccount_api.js b/pages/api/endpoint/updateaccount_api.js index d61a866f..5a3f6334 100644 --- a/pages/api/endpoint/updateaccount_api.js +++ b/pages/api/endpoint/updateaccount_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/updateaccount_api: + * patch: + * tags: [Account] + * description: Update account + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken } from "../../../actions"; diff --git a/pages/api/endpoint/updatecase_api.js b/pages/api/endpoint/updatecase_api.js index babcfa88..3d76c575 100644 --- a/pages/api/endpoint/updatecase_api.js +++ b/pages/api/endpoint/updatecase_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/updatecase_api: + * patch: + * tags: [Case] + * description: Update case + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken, patchCase } from "../../../actions"; diff --git a/pages/api/endpoint/updatepassword_api.js b/pages/api/endpoint/updatepassword_api.js index d61a866f..d23ab1b6 100644 --- a/pages/api/endpoint/updatepassword_api.js +++ b/pages/api/endpoint/updatepassword_api.js @@ -1,3 +1,14 @@ +/** + * @swagger + * /api/endpoint/updatepassword_api: + * patch: + * tags: [Account] + * description: Update password + * responses: + * 200: + * description: Success + */ + import axios from "axios"; import CryptoJS from "crypto-js"; import { getToken } from "../../../actions"; diff --git a/pages/api/file/getbloblist.js b/pages/api/file/getbloblist.js index 61f3c30b..cc455c1b 100644 --- a/pages/api/file/getbloblist.js +++ b/pages/api/file/getbloblist.js @@ -1,3 +1,33 @@ +/** + * @swagger + * /api/file/getbloblist: + * get: + * tags: [Azure Storage] + * description: Basic search documents details + * parameters: + * - name: container + * in: query + * required: true + * example: cl761h97h0008h11ycmu2qyfo + * schema: + * type: string + * - name: casefolderID + * in: query + * required: true + * example: TMP-AYJHX-SNW1H5 + * schema: + * type: string + * - name: hash + * in: query + * required: true + * example: 372c59f86d62b57cc2a7981eeee7737c944d407c6a7f2ea9d85797bbfe9852c5 + * schema: + * type: string + * responses: + * 200: + * description: Success + */ + import { hashAPIPath } from "../../../actions"; import { getBlobs } from "../../../actions/azurestorage"; diff --git a/public/swagger.json b/public/swagger.json index ce4b7051..a62c666c 100644 --- a/public/swagger.json +++ b/public/swagger.json @@ -1,13 +1,438 @@ { - "openapi": "3.0.0", + "openapi": "3.0.3", "info": { - "title": "Next Swagger API Example", + "title": "PEDW API", "version": "1.0" }, + "components": { + "schemas": { + "emailBody": { + "type": "object", + "properties": { + "reference": { + "type": "string", + "example": "PEDW-COMPLETE" + }, + "templateId": { + "type": "string", + "example": "618e0463-b092-4733-a024-bf8a3bbde808" + }, + "emailAddress": { + "type": "string", + "example": "rob@rdbtech.co.uk" + }, + "personalisation": { + "type": "object", + "example": { + "caseReference": "CAS-TEST-TEST", + "emailAddress": "rob@rdbtech.co.uk", + "linkExpiry": "10 * 60" + } + } + } + } + }, + "securitySchemes": { + "pedw_auth": { + "type": "oauth2", + "flows": { + "clientCredentials": { + "tokenUrl": "https://login.microsoftonline.com/9ac1a5ab-cd58-409e-a1b6-6b10422a68f5/oauth2/v2.0/token", + "scopes": "https://dev-pedw-ns.servicebus.windows.net/.default" + } + } + }, + "api_key": { + "type": "apiKey", + "name": "api_key", + "in": "header" + } + } + }, "paths": { - "/api/endpoint/getlogin_api": { - "tags": "Hello", + "/api/auth/[...nextauth]": { "get": { + "tags": [ + "Login" + ], + "description": "NextAuth", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/documents/download/{id}": { + "get": { + "tags": [ + "Documents" + ], + "description": "Get document", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "iShare ID", + "type": "string", + "required": true, + "default": "A41567436" + }, + { + "name": "hash", + "in": "query", + "description": "Hash string", + "default": "e0a1c9cd2817826a25bca67e60b807eae747cbed769e3ec42cf997541c32be71" + } + ], + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/email/notify": { + "post": { + "tags": [ + "Email" + ], + "summary": "Email to user", + "consumes": [ + "application/json" + ], + "description": "Send email via gov notify", + "produces": [ + "application/json", + "application/xml" + ], + "requestBody": { + "name": "Email", + "description": "Email body", + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/emailBody" + } + } + } + }, + "responses": { + "405": { + "description": "Failed" + } + } + } + }, + "/api/endpoint/createaccount_api": { + "post": { + "tags": [ + "Account" + ], + "description": "Create password", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/createcase_api": { + "post": { + "tags": [ + "Case" + ], + "description": "Create case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/createmywatchedcases_api": { + "post": { + "tags": [ + "Portal", + "Case" + ], + "description": "Create my watched cases", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteawaitingsubmissions_api": { + "delete": { + "tags": [ + "Case" + ], + "description": "Delete awaiting case submission", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteamyrepresentations_api": { + "delete": { + "tags": [ + "Portal", + "Representations" + ], + "description": "Delete my representations", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/deleteamywatchedcases_api": { + "delete": { + "tags": [ + "Portal", + "Case" + ], + "description": "Delete my watched cases", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getadvancedsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Advanced search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getadvancedsearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Advanced search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealid_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal ID", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealtypes_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal Types", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getappealtypesfornewappeal_api": { + "get": { + "tags": [ + "Misc" + ], + "description": "Get Appeal Types for appeal", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getawaitingsubmission_api": { + "get": { + "tags": [ + "Case" + ], + "description": "get awaiting case submission", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getawaitingsubmissionproxy_api": { + "get": { + "tags": [ + "Case" + ], + "description": "get awaiting case submission proxy", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchdetails_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnssearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicdnsurlsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic DNS search URL", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearch_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchdetails_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getbasicsearchpaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getcase_api": { + "get": { + "tags": [ + "Case" + ], + "summary": "Not used", + "description": "Get case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getlogin_api": { + "get": { + "tags": [ + "Login" + ], "description": "Returns the hello world", "responses": { "200": { @@ -18,15 +443,140 @@ }, "/api/endpoint/getlpa_api": { "get": { - "description": "Returns the hello world", + "tags": [ + "Search" + ], + "description": "Get list of LPA's", "responses": { "200": { - "description": "hello world" + "description": "Success" + } + }, + "security": [ + { + "relay_auth": [] + } + ] + } + }, + "/api/endpoint/getsearchdocumentdetails_api": { + "get": { + "tags": [ + "Search", + "Documents" + ], + "description": "Basic search documents details", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumentdetailspaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents details paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumenthistory_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumenthistorypaged_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/getsearchdocumentTypes_api": { + "get": { + "tags": [ + "Search" + ], + "description": "Basic search documents history paged", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/patchcase_api": { + "patch": { + "tags": [ + "Case" + ], + "description": "Patch case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updateaccount_api": { + "patch": { + "tags": [ + "Account" + ], + "description": "Update account", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updatecase_api": { + "patch": { + "tags": [ + "Case" + ], + "description": "Update case", + "responses": { + "200": { + "description": "Success" + } + } + } + }, + "/api/endpoint/updatepassword_api": { + "patch": { + "tags": [ + "Account" + ], + "description": "Update password", + "responses": { + "200": { + "description": "Success" } } } } }, - "components": {}, "tags": [] } \ No newline at end of file