recator placement of code

This commit is contained in:
2026-02-17 11:46:57 -06:00
parent 31f8c368d9
commit 23c000fa7f
77 changed files with 4528 additions and 2697 deletions

View File

@@ -0,0 +1,88 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const datamartAddSpec: OpenAPIV3_1.PathsObject = {
"/api/datamart": {
post: {
summary: "New datamart query",
description:
"Creates a new query entry in the datamart. Must be called on the main server. The SQL can be provided as a file upload.",
tags: ["Datamart"],
requestBody: {
required: true,
content: {
"multipart/form-data": {
schema: {
type: "object",
required: ["name", "description", "queryFile"],
properties: {
name: {
type: "string",
example: "active_av",
description: "Unique name for the query",
},
description: {
type: "string",
example: "Gets active audio/visual records",
description: "Short explanation of what this query does",
},
options: {
type: "string",
example: "foo,baz",
description:
"Optional comma separated options string passed to the query",
},
publicAccess: {
type: "boolean",
example: "true",
description:
"Will this query be accessible by the frontend's",
},
queryFile: {
type: "string",
format: "binary",
description: "SQL file containing the query text",
},
},
},
},
},
},
responses: {
"200": {
description: "Query successfully created",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: { type: "boolean", example: true },
message: {
type: "string",
example: "active_av was just added",
},
},
},
},
},
},
"400": {
description: "Validation or input error",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: { type: "boolean", example: false },
message: {
type: "string",
example: "Validation failed",
},
},
},
},
},
},
},
},
},
};

View File

@@ -0,0 +1,81 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const datamartUpdateSpec: OpenAPIV3_1.PathsObject = {
"/api/datamart": {
patch: {
summary: "Update datamart query",
description:
"Update query entry in the datamart. Must be called on the main server. The SQL must be provided as a file upload.",
tags: ["Datamart"],
requestBody: {
required: true,
content: {
"multipart/form-data": {
schema: {
type: "object",
properties: {
name: {
type: "string",
example: "active_av",
description: "Unique name for the query",
},
description: {
type: "string",
example: "Gets active articles",
description: "Short explanation of what this query does",
},
options: {
type: "string",
example: "foo,baz",
description:
"Optional comma separated options string passed to the query",
},
queryFile: {
type: "string",
format: "binary",
description: "SQL file containing the query text",
},
},
},
},
},
},
responses: {
"200": {
description: "Query successfully created",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: { type: "boolean", example: true },
message: {
type: "string",
example: "active_av was just added",
},
},
},
},
},
},
"400": {
description: "Validation or input error",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: { type: "boolean", example: false },
message: {
type: "string",
example: "Validation failed",
},
},
},
},
},
},
},
},
},
};

View File

@@ -0,0 +1,77 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const getDatamartSpec: OpenAPIV3_1.PathsObject = {
"/api/datamart/{name}": {
get: {
summary: "Runs the query by name",
description:
"This will allow to run any query by its name and optional parameters to be sent over as well, up to 3 params can be added",
tags: ["Datamart"],
parameters: [
{
name: "name",
in: "path",
required: false,
description: "Name to look up",
schema: {
type: "string",
},
example: "exampleName",
},
{
name: "limit",
in: "query",
required: false, // 👈 optional
description: "Maximum number of records to return",
schema: {
type: "integer",
minimum: 1,
maximum: 100,
},
example: 10,
},
],
responses: {
"200": {
description: "Successful response",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: { type: "boolean", example: true },
data: {
type: "object",
example: {
name: "exampleName",
value: "some value",
},
},
},
},
},
},
},
"400": {
description: "Bad request",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: { type: "boolean", example: false },
message: {
type: "string",
example: "Invalid name parameter",
},
},
},
},
},
},
},
},
},
};

View File

@@ -0,0 +1,122 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const prodLoginSpec: OpenAPIV3_1.PathsObject = {
"/api/authentication/login": {
post: {
summary: "Login",
description:
"Allows login by username and password and returns the user object to get the session data.",
tags: ["Auth"],
requestBody: {
required: true,
content: {
"application/json": {
schema: {
type: "object",
required: ["username", "password"],
properties: {
username: {
type: "string",
example: "jdoe",
},
password: {
type: "string",
format: "password",
example: "superSecretPassword",
},
},
},
},
},
},
responses: {
"200": {
description: "User info",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
example: true,
},
message: {
type: "string",
example: "Welcome back jdoe123",
},
level: {
type: "string",
},
module: {
type: "string",
},
subModule: {
type: "string",
},
data: {
type: "array",
items: {
type: "object",
properties: {
redirect: { type: "boolean" },
token: { type: "string" },
user: {
type: "object",
properties: {
id: { type: "string" },
name: { type: "string" },
email: { type: "string", format: "email" },
username: { type: "string" },
role: { type: "string" },
createdAt: { type: "string", format: "date-time" },
updatedAt: { type: "string", format: "date-time" },
},
},
},
},
},
},
},
},
},
},
"401": {
description: "Login failed",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
example: false,
},
message: {
type: "string",
example:
"jdoe1234 dose not appear to be a valid username please try again",
},
level: {
type: "string",
example: "error",
},
module: {
type: "string",
example: "routes",
},
subModule: {
type: "string",
example: "auth",
},
},
},
},
},
},
},
},
},
};

View File

@@ -0,0 +1,34 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const prodRestartSpec: OpenAPIV3_1.PathsObject = {
"/api/system/prodSql/restart": {
post: {
summary: "Prod restart sql connection",
description: "Attempts to restart the sql connection.",
tags: ["System"],
responses: {
"200": {
description: "Success from server restarting",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
format: "true",
example: true,
},
message: {
type: "string",
format: "Sql Server has been restarted",
},
},
},
},
},
},
},
},
},
};

View File

@@ -0,0 +1,55 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const prodStartSpec: OpenAPIV3_1.PathsObject = {
"/api/system/prodSql/start": {
post: {
summary: "Prod start sql connection",
description: "Connects to the prod sql server.",
tags: ["System"],
responses: {
"200": {
description: "Data that is returned from the connection",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
format: "true",
example: true,
},
message: {
type: "string",
format: "usmcd1vms036 is connected to AlplaPROD_test3_cus",
},
},
},
},
},
},
"400": {
description: "Data that is returned from the connection",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
format: "false",
example: false,
},
message: {
type: "string",
format: "The Sql server is already connected.",
},
},
},
},
},
},
},
},
},
};

View File

@@ -0,0 +1,56 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const prodStopSpec: OpenAPIV3_1.PathsObject = {
"/api/system/prodSql/stop": {
post: {
summary: "Prod stop sql connection",
description: "Closes the connection to the prod server.",
tags: ["System"],
responses: {
"200": {
description: "Success from server starting",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
format: "true",
example: true,
},
message: {
type: "string",
format: "The sql connection has been closed.",
},
},
},
},
},
},
"400": {
description: "Errors on why the server could not be stopped",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
format: "false",
example: false,
},
message: {
type: "string",
format:
"There is no connection to the prod server currently.",
},
},
},
},
},
},
},
},
},
};

View File

@@ -0,0 +1,87 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const prodRegisterSpec: OpenAPIV3_1.PathsObject = {
"/api/authentication/register": {
post: {
summary: "Register",
description: "Registers a new user.",
tags: ["Auth"],
requestBody: {
required: true,
content: {
"application/json": {
schema: {
type: "object",
required: ["username", "password", "email"],
properties: {
username: {
type: "string",
example: "jdoe",
},
name: {
type: "string",
format: "string",
example: "joe",
},
email: {
type: "string",
format: "email",
example: "joe.doe@alpla.net",
},
password: {
type: "string",
format: "password",
example: "superSecretPassword",
},
},
},
},
},
},
responses: {
"200": {
description: "User info",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
format: "true",
example: true,
},
message: {
type: "string",
example: "User was created",
},
},
},
},
},
},
"400": {
description: "Invalid Data was sent over",
content: {
"application/json": {
schema: {
type: "object",
properties: {
success: {
type: "boolean",
format: "false",
example: false,
},
message: {
type: "string",
format: "Invalid Data was sent over.",
},
},
},
},
},
},
},
},
},
};

View File

@@ -0,0 +1,43 @@
import type { OpenAPIV3_1 } from "openapi-types";
export const statusSpec: OpenAPIV3_1.PathsObject = {
"/api/stats": {
get: {
summary: "Server Status",
description: "Checks the status of the server.",
tags: ["System"],
responses: {
"200": {
description: "Stats from the server",
content: {
"application/json": {
schema: {
type: "object",
properties: {
status: {
type: "string",
format: "ok",
example: "ok",
},
uptime: {
type: "number",
format: "3454.34",
example: 3454.34,
},
memoryUsage: {
type: "string",
format: "Heap: 11.62 MB / RSS: 86.31 MB",
},
sqlServerStats: {
type: "number",
format: "442127",
},
},
},
},
},
},
},
},
},
};