From 6d0fbcd1378a07f63fc322ca8e4588b958f2ca10 Mon Sep 17 00:00:00 2001 From: haidousm Date: Sat, 21 May 2022 18:30:24 +0300 Subject: [PATCH] sort services according to order --- client/src/components/projects/ProjectCard.tsx | 2 +- client/src/pages/projects/[projectName]/index.tsx | 6 +++++- server/src/utils/swagger.ts | 13 +++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/client/src/components/projects/ProjectCard.tsx b/client/src/components/projects/ProjectCard.tsx index e3251bd..7ccda28 100644 --- a/client/src/components/projects/ProjectCard.tsx +++ b/client/src/components/projects/ProjectCard.tsx @@ -27,7 +27,7 @@ function ProjectCard({ (async () => { const response = await getServicesForProject(project); if (response.status == 200) { - setServices(response.data); + setServices(response.data.sort((a, b) => a.order - b.order)); } else { router.push("500"); } diff --git a/client/src/pages/projects/[projectName]/index.tsx b/client/src/pages/projects/[projectName]/index.tsx index 7480fd9..8ebb432 100644 --- a/client/src/pages/projects/[projectName]/index.tsx +++ b/client/src/pages/projects/[projectName]/index.tsx @@ -29,7 +29,11 @@ const ProjectDashboard: NextPage = () => { response.data ); if (anotherResponse.status == 200) { - setServices(anotherResponse.data); + setServices( + anotherResponse.data.sort( + (a, b) => a.order - b.order + ) + ); } else { router.push("/500"); } diff --git a/server/src/utils/swagger.ts b/server/src/utils/swagger.ts index 84ba34e..7783c17 100644 --- a/server/src/utils/swagger.ts +++ b/server/src/utils/swagger.ts @@ -4,7 +4,7 @@ import swaggerUi from "swagger-ui-express"; import { version } from "../../package.json"; import logger from "./logger"; -const options: swaggerJsdoc.Options = { +const options: swaggerJsdoc.OAS3Options = { definition: { openapi: "3.0.0", info: { @@ -20,7 +20,16 @@ const options: swaggerJsdoc.Options = { }, }, }, - basePath: "/api", // temp fix to work with deployment (not gonna work locally) + servers: [ + { + url: "https://moussa.sh/api", + description: "Production Server", + }, + { + url: "http://localhost:8010", + description: "Localhost", + }, + ], security: [ { bearerAuth: [],