Add mobile dashboard, allow longer auth sessions

This commit is contained in:
2026-07-20 11:51:09 -04:00
parent d779228485
commit 6c973f0a9d
13 changed files with 1219 additions and 67 deletions
+7 -9
View File
@@ -136,7 +136,7 @@ router.put('/products/:pid', async (req, res) => {
const pool = req.app.locals.pool;
try {
const { pid } = req.params;
const { lead_time_days, days_of_stock, safety_stock, forecast_method, exclude_from_forecast } = req.body;
const { lead_time_days, days_of_stock, safety_stock, exclude_from_forecast } = req.body;
console.log(`[Config Route] Updating product settings for ${pid}:`, req.body);
@@ -149,10 +149,10 @@ router.put('/products/:pid', async (req, res) => {
if (checkProduct.length === 0) {
// Insert if it doesn't exist
await pool.query(
`INSERT INTO settings_product
(pid, lead_time_days, days_of_stock, safety_stock, forecast_method, exclude_from_forecast)
VALUES ($1, $2, $3, $4, $5, $6)`,
[pid, lead_time_days, days_of_stock, safety_stock, forecast_method, exclude_from_forecast]
`INSERT INTO settings_product
(pid, lead_time_days, days_of_stock, safety_stock, exclude_from_forecast)
VALUES ($1, $2, $3, $4, $5)`,
[pid, lead_time_days, days_of_stock, safety_stock, exclude_from_forecast]
);
} else {
// Update if it exists
@@ -161,11 +161,10 @@ router.put('/products/:pid', async (req, res) => {
SET lead_time_days = $2,
days_of_stock = $3,
safety_stock = $4,
forecast_method = $5,
exclude_from_forecast = $6,
exclude_from_forecast = $5,
updated_at = CURRENT_TIMESTAMP
WHERE pid::text = $1`,
[pid, lead_time_days, days_of_stock, safety_stock, forecast_method, exclude_from_forecast]
[pid, lead_time_days, days_of_stock, safety_stock, exclude_from_forecast]
);
}
@@ -190,7 +189,6 @@ router.post('/products/:pid/reset', async (req, res) => {
SET lead_time_days = NULL,
days_of_stock = NULL,
safety_stock = 0,
forecast_method = NULL,
exclude_from_forecast = false,
updated_at = CURRENT_TIMESTAMP
WHERE pid::text = $1`,