db cleanups and logging for od
This commit is contained in:
@@ -5,12 +5,11 @@ import type { Express } from "express";
|
||||
//const __filename = fileURLToPath(import.meta.url);
|
||||
// const __dirname = path.dirname(__filename);
|
||||
|
||||
import os from "node:os";
|
||||
import { apiReference } from "@scalar/express-api-reference";
|
||||
// const port = 3000;
|
||||
import type { OpenAPIV3_1 } from "openapi-types";
|
||||
import { datamartAddSpec } from "../scaler/datamartAdd.spec.js";
|
||||
import { datamartUpdateSpec } from "../scaler/datamartUpdate.spec.js";
|
||||
import { getDatamartSpec } from "../scaler/getDatamart.spec.js";
|
||||
import { cronerActiveJobs } from "../scaler/cronerActiveJobs.spec.js";
|
||||
import { prodLoginSpec } from "../scaler/login.spec.js";
|
||||
import { prodRestartSpec } from "../scaler/prodSqlRestart.spec.js";
|
||||
import { prodStartSpec } from "../scaler/prodSqlStart.spec.js";
|
||||
@@ -28,7 +27,8 @@ export const openApiBase: OpenAPIV3_1.Document = {
|
||||
},
|
||||
servers: [
|
||||
{
|
||||
url: `http://localhost:3000${process.env.NODE_ENV?.trim() !== "production" ? "/lst" : "/"}`,
|
||||
// TODO: change this to the https:// if we are in production and port if not.
|
||||
url: `http://${os.hostname()}:3000${process.env.NODE_ENV?.trim() !== "production" ? "/lst" : "/"}`,
|
||||
description: "Development server",
|
||||
},
|
||||
],
|
||||
@@ -73,9 +73,8 @@ export const openApiBase: OpenAPIV3_1.Document = {
|
||||
description: "All system endpoints that will be available to run",
|
||||
},
|
||||
{
|
||||
name: "Datamart",
|
||||
description:
|
||||
"All Special queries to run based on there names.\n Refer to the docs to see all possible queries that can be ran here, you can also run the getQueries to see available.",
|
||||
name: "Utils",
|
||||
description: "All routes related to the utilities on the server",
|
||||
},
|
||||
// { name: "TMS", description: "TMS integration" },
|
||||
],
|
||||
@@ -83,14 +82,21 @@ export const openApiBase: OpenAPIV3_1.Document = {
|
||||
};
|
||||
|
||||
export const setupApiDocsRoutes = (baseUrl: string, app: Express) => {
|
||||
const mergedDatamart = {
|
||||
"/api/datamart": {
|
||||
...(getDatamartSpec["/api/datamart"] ?? {}),
|
||||
...(datamartAddSpec["/api/datamart"] ?? {}),
|
||||
...(datamartUpdateSpec["/api/datamart"] ?? {}),
|
||||
},
|
||||
"/api/datamart/{name}": getDatamartSpec["/api/datamart/{name}"],
|
||||
};
|
||||
// const mergedDatamart = {
|
||||
// "/api/datamart": {
|
||||
// ...(cronerActiveJobs["/api/datamart"] ?? {}),
|
||||
// ...(datamartAddSpec["/api/datamart"] ?? {}),
|
||||
// ...(datamartUpdateSpec["/api/datamart"] ?? {}),
|
||||
// },
|
||||
// "/api/datamart/{name}": getDatamartSpec["/api/datamart/{name}"],
|
||||
// };
|
||||
|
||||
// const mergeUtils = {
|
||||
// "/api/utils/croner": {
|
||||
// ...(cronerActiveJobs["/api/utils/croner"] ?? {}),
|
||||
// },
|
||||
// "/api/utils/{name}": cronerActiveJobs["/api/utils/{name}"],
|
||||
// };
|
||||
|
||||
const fullSpec = {
|
||||
...openApiBase,
|
||||
@@ -101,7 +107,8 @@ export const setupApiDocsRoutes = (baseUrl: string, app: Express) => {
|
||||
...prodRestartSpec,
|
||||
...prodLoginSpec,
|
||||
...prodRegisterSpec,
|
||||
...mergedDatamart,
|
||||
//...mergedDatamart,
|
||||
...cronerActiveJobs,
|
||||
|
||||
// Add more specs here as you build features
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user