feat(datamart): psi data has been added :D
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Response } from "express";
|
||||
import { createLogger } from "../logger/logger.controller.js";
|
||||
|
||||
interface Data<T = unknown[]> {
|
||||
export interface ReturnHelper<T = unknown[]> {
|
||||
success: boolean;
|
||||
module:
|
||||
| "system"
|
||||
@@ -13,31 +13,10 @@ interface Data<T = unknown[]> {
|
||||
| "notification"
|
||||
| "email"
|
||||
| "purchase"
|
||||
| "tcp";
|
||||
subModule:
|
||||
| "db"
|
||||
| "labeling"
|
||||
| "printer"
|
||||
| "prodSql"
|
||||
| "query"
|
||||
| "sendmail"
|
||||
| "auth"
|
||||
| "datamart"
|
||||
| "jobs"
|
||||
| "apt"
|
||||
| "settings"
|
||||
| "get"
|
||||
| "update"
|
||||
| "delete"
|
||||
| "post"
|
||||
| "notification"
|
||||
| "delete"
|
||||
| "printing"
|
||||
| "gpSql"
|
||||
| "email"
|
||||
| "gpChecks"
|
||||
| "prodEndpoint"
|
||||
| "create_server";
|
||||
| "tcp"
|
||||
| "logistics";
|
||||
subModule: string;
|
||||
|
||||
level: "info" | "error" | "debug" | "fatal" | "warn";
|
||||
message: string;
|
||||
room?: string;
|
||||
@@ -59,7 +38,7 @@ interface Data<T = unknown[]> {
|
||||
* data: [] the data that will be passed back
|
||||
* notify: false by default this is to send a notification to a users email to alert them of an issue.
|
||||
*/
|
||||
export const returnFunc = (data: Data) => {
|
||||
export const returnFunc = (data: ReturnHelper) => {
|
||||
const notify = data.notify ? data.notify : false;
|
||||
const room = data.room ?? data.room;
|
||||
const log = createLogger({ module: data.module, subModule: data.subModule });
|
||||
@@ -92,7 +71,7 @@ export const returnFunc = (data: Data) => {
|
||||
|
||||
export function apiReturn(
|
||||
res: Response,
|
||||
opts: Data & { status?: number },
|
||||
opts: ReturnHelper & { status?: number },
|
||||
optional?: unknown, // leave this as unknown so we can pass an object or an array over.
|
||||
): Response {
|
||||
const result = returnFunc(opts);
|
||||
|
||||
Reference in New Issue
Block a user