feat(frontend): migrated old > new silo adjustments

moved the apps around so we can use 1 url for cors bs
This commit is contained in:
2025-10-25 17:22:51 -05:00
parent d46ef922f3
commit 425f8f5f71
179 changed files with 7511 additions and 2724 deletions

View File

@@ -0,0 +1,15 @@
/**
* When we pass over the edi data we want to now store it so we can see the day to day
* id
* itemNumber // customer code
* date requested
* qty requested
* av - what av this is linked to
* add_date
*/
type IncomingForecastData = {
CustomerArticleNumber: number;
};
export const forecastData = async (data: IncomingForecastData) => {};

View File

@@ -12,5 +12,19 @@
"description": "What is the db server",
"moduleName": "system",
"roles": ["systemAdmin"]
},
{
"name": "v1Server",
"value": "localhost",
"description": "What is the port the v1app is on",
"moduleName": "system",
"roles": ["systemAdmin"]
},
{
"name": "v1Port",
"value": "3000",
"description": "What is the port the v1app is on",
"moduleName": "system",
"roles": ["systemAdmin"]
}
]

View File

@@ -1,35 +1,36 @@
import { Router } from "express";
import { and, asc, eq } from "drizzle-orm";
import type { Request, Response } from "express";
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
import { Router } from "express";
import { db } from "../../../../pkg/db/db.js";
import { serverData } from "../../../../pkg/db/schema/servers.js";
import { and, asc, eq } from "drizzle-orm";
import { settings } from "../../../../pkg/db/schema/settings.js";
import { tryCatch } from "../../../../pkg/utils/tryCatch.js";
const router = Router();
router.get("/", async (req: Request, res: Response) => {
const token = req.query.token;
const token = req.query.token;
const conditions = [];
const conditions = [];
if (token !== undefined) {
conditions.push(eq(serverData.plantToken, `${token}`));
}
if (token !== undefined) {
conditions.push(eq(serverData.plantToken, `${token}`));
}
conditions.push(eq(serverData.active, true));
conditions.push(eq(serverData.active, true));
const { data, error } = await tryCatch(
db
.select()
.from(serverData)
.where(and(...conditions))
.orderBy(asc(serverData.name))
);
const { data, error } = await tryCatch(
db
.select()
.from(settings)
//.where(and(...conditions))
.orderBy(asc(settings.name)),
);
if (error) {
return res.status(400).json({ error: error });
}
res.status(200).json({ message: "Current Active server", data: data });
if (error) {
return res.status(400).json({ error: error });
}
res.status(200).json({ message: "Current Active server", data: data });
});
export default router;

View File

@@ -0,0 +1,29 @@
import {
boolean,
integer,
jsonb,
pgTable,
real,
text,
timestamp,
uuid,
} from "drizzle-orm/pg-core";
import { createInsertSchema, createSelectSchema } from "drizzle-zod";
import { z } from "zod";
export const forecastData = pgTable("forecast_Data", {
id: uuid("id").defaultRandom().primaryKey(),
customerArticleNumber: text("customer_article_number"),
dateRequested: timestamp("date_requested").defaultNow(),
quantity: real("quantity"),
requestDate: timestamp("request_date").notNull(),
article: integer("article"),
customerID: integer("customer_id").notNull(),
createdAt: timestamp("created_at").defaultNow(),
});
export const forecastDataSchema = createSelectSchema(forecastData);
export const newForecastDataSchema = createInsertSchema(forecastData);
export type ForecastData = z.infer<typeof forecastDataSchema>;
export type NewForecastData = z.infer<typeof newForecastDataSchema>;