diff --git a/.github/workflows/deploy2ec2.yml b/.github/workflows/deploy2ec2.yml index c11fda2e..ee14fa48 100644 --- a/.github/workflows/deploy2ec2.yml +++ b/.github/workflows/deploy2ec2.yml @@ -75,3 +75,7 @@ jobs: echo "BUILT" # Cleanup sudo docker builder prune -af + + echo "NGINX Restarted" + # Restart nginx + sudo systemctl restart nginx diff --git a/apps/backend/domain-repos/@services/draft-healthcare-service b/apps/backend/domain-repos/@services/draft-healthcare-service index 7de7b314..d91c8c66 160000 --- a/apps/backend/domain-repos/@services/draft-healthcare-service +++ b/apps/backend/domain-repos/@services/draft-healthcare-service @@ -1 +1 @@ -Subproject commit 7de7b3145ed2cc2681bebe71cd835b6317030379 +Subproject commit d91c8c66e5cd4b39a1701b92ce856d339941c9d2 diff --git a/apps/backend/domain-repos/@services/draft-services b/apps/backend/domain-repos/@services/draft-services index d56f3cc5..74b56e0b 160000 --- a/apps/backend/domain-repos/@services/draft-services +++ b/apps/backend/domain-repos/@services/draft-services @@ -1 +1 @@ -Subproject commit d56f3cc560ec768861f66d0846f4b7c233495b9d +Subproject commit 74b56e0b71bf480b01231ece66f6b289d702aece diff --git a/apps/backend/src/index.ts b/apps/backend/src/index.ts index 27aa7425..a26a264b 100644 --- a/apps/backend/src/index.ts +++ b/apps/backend/src/index.ts @@ -1,3 +1,4 @@ +import 'dotenv/config' import express, { Express, Request, Response } from "express"; import swaggerUi from "swagger-ui-express"; import cron from "node-cron"; // Import node-cron @@ -25,7 +26,7 @@ import { import { retailRouter } from "./controllers/retail"; import { sendUpsolicieatedOnStatus } from "./lib/utils/sendUpsolicieatedOnStatus"; import { loadConfig } from "./lib/utils"; -import 'dotenv/config' + export const app: Express = express(); const port = process.env.PORT || 3000; diff --git a/apps/backend/src/lib/utils/redis.ts b/apps/backend/src/lib/utils/redis.ts index 091e2006..d3e664dc 100644 --- a/apps/backend/src/lib/utils/redis.ts +++ b/apps/backend/src/lib/utils/redis.ts @@ -1,5 +1,4 @@ import Redis, { RedisOptions } from "ioredis"; - const redisOptions: RedisOptions = { host: process.env.REDIS_HOST || "localhost", port: (process.env.REDIS_PORT || 6379) as number, @@ -12,6 +11,7 @@ export type TransactionType = { response?: object }; +console.log("REDIS OPTIONS", redisOptions); export const redis = new Redis(redisOptions); diff --git a/apps/frontend/src/components/MockRequestSection.tsx b/apps/frontend/src/components/MockRequestSection.tsx index 24791316..4e1bbebd 100644 --- a/apps/frontend/src/components/MockRequestSection.tsx +++ b/apps/frontend/src/components/MockRequestSection.tsx @@ -18,6 +18,7 @@ import { useAction, useDomain, useMock } from "../utils/hooks"; import { URL_MAPPING } from "../utils"; import axios, { AxiosError } from "axios"; import { UserGuide } from "./UserGuideSection"; +import { VITE_SERVER_URL } from "../utils/env"; // type MockRequestSectionProp = { // domain: string; @@ -33,13 +34,14 @@ export const MockRequestSection = () => { const { domain } = useDomain(); const [version, setVersion] = useState(""); - const { action, detectAction, logError, scenarios,setLogError } = useAction(); + const { action, detectAction, logError, scenarios, setLogError } = + useAction(); const { setAsyncResponse, setSyncResponse } = useMock(); - useEffect(()=>{ - setLog("") - setLogError(false) - },[domain]) + useEffect(() => { + setLog(""); + setLogError(false); + }, [domain]); useEffect(() => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore @@ -53,10 +55,14 @@ export const MockRequestSection = () => { const [curl, setCurl] = useState(); const handleVersion = ( - event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | null, + event: + | React.MouseEvent + | React.KeyboardEvent + | React.FocusEvent + | null, value: {} | null ) => { - console.log("event",event) + console.log("event", event); if (value) { setVersion(value as string); // Ensure value is a string and set the version } @@ -64,13 +70,13 @@ export const MockRequestSection = () => { const handleLogChange = (e: React.ChangeEvent) => { setLog(e.target.value); - detectAction(e.target.value,version); + detectAction(e.target.value, version); }; const handleSubmit = async () => { - let url = `${[ - import.meta.env.VITE_SERVER_URL, - ]}/${domain.toLowerCase()}/${Object.keys(URL_MAPPING).filter((key) => + let url = `${ + VITE_SERVER_URL + }/${domain.toLowerCase()}/${Object.keys(URL_MAPPING).filter((key) => URL_MAPPING[key as keyof typeof URL_MAPPING].includes(action as string) )}/${action}?mode=mock&version=${version}`; if (activeScenario?.scenario) @@ -86,10 +92,10 @@ export const MockRequestSection = () => { const response = await axios.post(url, JSON.parse(log as string), { headers: { "Content-Type": "application/json", - "mode": "mock" + mode: "mock", }, }); - + setSyncResponse(response.data.sync); setAsyncResponse(response.data.async || {}); } catch (error) { @@ -111,7 +117,11 @@ export const MockRequestSection = () => { Mock Server {domain === "retail" && ( - diff --git a/apps/frontend/src/components/SandboxRequestSection.tsx b/apps/frontend/src/components/SandboxRequestSection.tsx index d60b6bf9..dbbe3fce 100644 --- a/apps/frontend/src/components/SandboxRequestSection.tsx +++ b/apps/frontend/src/components/SandboxRequestSection.tsx @@ -19,6 +19,7 @@ import { useAction, useDomain, useSandbox } from "../utils/hooks"; import { URL_MAPPING } from "../utils"; import axios, { AxiosError } from "axios"; import { UserGuide } from "./UserGuideSection"; +import { VITE_SERVER_URL } from "../utils/env"; export const SandboxRequestSection = () => { const [authHeader, setAuthHeader] = useState(); @@ -54,20 +55,23 @@ export const SandboxRequestSection = () => { }; const handleVersion = ( - event: React.MouseEvent | React.KeyboardEvent | React.FocusEvent | null, + event: + | React.MouseEvent + | React.KeyboardEvent + | React.FocusEvent + | null, value: {} | null ) => { - console.log("event",event) + console.log("event", event); if (value) { setVersion(value as string); // Ensure value is a string and set the version } }; - const handleSubmit = async () => { - let url = `${[ - import.meta.env.VITE_SERVER_URL, - ]}/${domain.toLowerCase()}/${Object.keys(URL_MAPPING).filter((key) => + let url = `${ + VITE_SERVER_URL + }/${domain.toLowerCase()}/${Object.keys(URL_MAPPING).filter((key) => URL_MAPPING[key as keyof typeof URL_MAPPING].includes(action as string) )}/${action}?mode=sandbox&version=${version}`; diff --git a/apps/frontend/src/components/TransactionSearch.tsx b/apps/frontend/src/components/TransactionSearch.tsx index 5f9e9941..c1cd9b86 100644 --- a/apps/frontend/src/components/TransactionSearch.tsx +++ b/apps/frontend/src/components/TransactionSearch.tsx @@ -12,6 +12,7 @@ import * as _ from "lodash"; import { useAnalyse, useMessage } from "../utils/hooks"; import { useState } from "react"; import RefreshIcon from "@mui/icons-material/Refresh"; +import { VITE_SERVER_URL } from "../utils/env"; export const TransactionSearch = () => { const theme = useTheme(); @@ -21,9 +22,10 @@ export const TransactionSearch = () => { const [transactionId, setTransactionId] = useState(""); const fetchTransaction = async (transaction: string) => { + console.log('API URL:', VITE_SERVER_URL); try { const response = await axios.get( - `${import.meta.env.VITE_SERVER_URL}/analyse/${transaction}` + `${VITE_SERVER_URL}/analyse/${transaction}` ); const formattedResponse = response.data .reduce( diff --git a/apps/frontend/src/pages/sandbox/InitiateRequestSection.tsx b/apps/frontend/src/pages/sandbox/InitiateRequestSection.tsx index 5143adf4..3013d97b 100644 --- a/apps/frontend/src/pages/sandbox/InitiateRequestSection.tsx +++ b/apps/frontend/src/pages/sandbox/InitiateRequestSection.tsx @@ -16,6 +16,7 @@ import { useDomain, useEnvironment, useMessage } from "../../utils/hooks"; import HelpOutlineTwoToneIcon from "@mui/icons-material/HelpOutlineTwoTone"; import IconButton from "@mui/material/IconButton"; import Tooltip from "@mui/material/Tooltip"; +import { VITE_SERVER_URL } from "../../utils/env"; // import { Item } from "common/index"; // type InitiateRequestSectionProp = { @@ -98,7 +99,7 @@ export const InitiateRequestSection = () => { message: { matchingItems: any[] }; }>( `${ - import.meta.env.VITE_SERVER_URL + VITE_SERVER_URL }/${domain.toLowerCase()}/getCatalog/?mode=mock`, { transactionId }, { @@ -237,10 +238,11 @@ export const InitiateRequestSection = () => { const handleSubmit = async () => { try { + console.log('API URL:', VITE_SERVER_URL); const response = await axios.post( `${ - import.meta.env.VITE_SERVER_URL - }/${domain}/initiate/${action}?mode=mock&version=${version}&scenario=${selectedScenario}`, + VITE_SERVER_URL + }/${domain.toLowerCase()}/initiate/${action}?mode=mock&version=${version}&scenario=${selectedScenario}`, formState, { headers: { diff --git a/apps/frontend/src/pages/sign/index.tsx b/apps/frontend/src/pages/sign/index.tsx index d24914c1..2c23cebe 100644 --- a/apps/frontend/src/pages/sign/index.tsx +++ b/apps/frontend/src/pages/sign/index.tsx @@ -12,6 +12,7 @@ import { useState } from "react"; import axios, { AxiosError } from "axios"; import { MessageDialog } from "../../components"; import { useMessage } from "../../utils/hooks"; +import { VITE_SERVER_URL } from "../../utils/env"; export const Sign = () => { const theme = useTheme(); @@ -22,7 +23,7 @@ export const Sign = () => { const handleSubmit = async () => { try { const response = await axios.post( - `${[import.meta.env.VITE_SERVER_URL]}/auth/signCheck`, + `${VITE_SERVER_URL}/auth/signCheck`, requestBody, { headers: { diff --git a/apps/frontend/src/pages/swagger/domains/auth/index.tsx b/apps/frontend/src/pages/swagger/domains/auth/index.tsx index 77ec3859..6e5a1646 100644 --- a/apps/frontend/src/pages/swagger/domains/auth/index.tsx +++ b/apps/frontend/src/pages/swagger/domains/auth/index.tsx @@ -3,13 +3,14 @@ import "swagger-ui-react/swagger-ui.css"; import { Toolbar } from "@mui/material"; import swaggerSpec from "openapi-specs/auth.json"; import { SwaggerDownloadButton } from "../../../../components"; +import { VITE_SERVER_URL } from "../../../../utils/env"; export const AuthSwagger = () => { swaggerSpec.servers = swaggerSpec.servers.map(({ url }: { url: string }) => - url.startsWith(import.meta.env.VITE_SERVER_URL) + url.startsWith(VITE_SERVER_URL) ? { url } : { - url: import.meta.env.VITE_SERVER_URL + url.replace("/api", ""), + url: VITE_SERVER_URL + url.replace("/api", ""), // eslint-disable-next-line no-mixed-spaces-and-tabs } ); diff --git a/apps/frontend/src/pages/swagger/domains/misc/index.tsx b/apps/frontend/src/pages/swagger/domains/misc/index.tsx index c6374c23..44e6f64c 100644 --- a/apps/frontend/src/pages/swagger/domains/misc/index.tsx +++ b/apps/frontend/src/pages/swagger/domains/misc/index.tsx @@ -3,13 +3,14 @@ import "swagger-ui-react/swagger-ui.css"; import { Toolbar } from "@mui/material"; import swaggerSpec from "openapi-specs/misc.json"; import { SwaggerDownloadButton } from "../../../../components"; +import { VITE_SERVER_URL } from "../../../../utils/env"; export const MiscSwagger = () => { swaggerSpec.servers = swaggerSpec.servers.map(({ url }: { url: string }) => - url.startsWith(import.meta.env.VITE_SERVER_URL) + url.startsWith(VITE_SERVER_URL) ? { url } : { - url: import.meta.env.VITE_SERVER_URL + url.replace("/api", ""), + url: VITE_SERVER_URL + url.replace("/api", ""), // eslint-disable-next-line no-mixed-spaces-and-tabs } ); diff --git a/apps/frontend/src/utils/env.ts b/apps/frontend/src/utils/env.ts new file mode 100644 index 00000000..4e115fbd --- /dev/null +++ b/apps/frontend/src/utils/env.ts @@ -0,0 +1 @@ +export const VITE_SERVER_URL = import.meta.env.VITE_SERVER_URL || "https://mock.ondc.org/api"; \ No newline at end of file diff --git a/init_submodules.sh b/init_submodules.sh index f0d098d2..9e0f2256 100644 --- a/init_submodules.sh +++ b/init_submodules.sh @@ -12,9 +12,10 @@ git submodule add -b b2c_exports_2.0 https://github.com/ONDC-Official/ONDC-RET-S # Services git submodule add -b draft-services https://github.com/ONDC-Official/ONDC-SRV-Specifications domain-repos/@services/draft-services git submodule add -b draft-agri_services https://github.com/ONDC-Official/ONDC-SRV-Specifications domain-repos/@services/draft-agri-services -git submodule add -b draft-healthcare https://github.com/ONDC-Official/ONDC-SRV-Specifications domain-repos/@services/draft-healthcare-services +git submodule add -b draft-healthcare https://github.com/ONDC-Official/ONDC-SRV-Specifications domain-repos/@services/draft-healthcare-service git submodule add -b draft-agri_equipment https://github.com/ONDC-Official/ONDC-SRV-Specifications domain-repos/@services/draft-agri_equipment git submodule add -b draft-agri_bids_and_auction https://github.com/ONDC-Official/ONDC-SRV-Specifications domain-repos/@services/draft-agri_bids_and_auction +git submodule add -b draft-astro https://github.com/ONDC-Official/ONDC-SRV-Specifications domain-repos/@services/draft-astro # Logisitcs diff --git a/packages/openapi/domain-repos/@services/draft-healthcare-services b/packages/openapi/domain-repos/@services/draft-healthcare-services index 7de7b314..d91c8c66 160000 --- a/packages/openapi/domain-repos/@services/draft-healthcare-services +++ b/packages/openapi/domain-repos/@services/draft-healthcare-services @@ -1 +1 @@ -Subproject commit 7de7b3145ed2cc2681bebe71cd835b6317030379 +Subproject commit d91c8c66e5cd4b39a1701b92ce856d339941c9d2 diff --git a/packages/openapi/domain-repos/@services/draft-services b/packages/openapi/domain-repos/@services/draft-services index d56f3cc5..74b56e0b 160000 --- a/packages/openapi/domain-repos/@services/draft-services +++ b/packages/openapi/domain-repos/@services/draft-services @@ -1 +1 @@ -Subproject commit d56f3cc560ec768861f66d0846f4b7c233495b9d +Subproject commit 74b56e0b71bf480b01231ece66f6b289d702aece diff --git a/turbo.json b/turbo.json index 70d01758..7942a940 100644 --- a/turbo.json +++ b/turbo.json @@ -10,7 +10,6 @@ "persistent": false }, "dev": { - "dependsOn": ["db:migrate:dev","start:nginx"], "cache": false, "persistent": true },