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:
@@ -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) => {};
|
||||
@@ -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"]
|
||||
}
|
||||
]
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user