mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-22 14:38:19 +02:00
Update server configuration and types for improved stability
Revert and adjust TypeScript configurations, refine server route types, and update database connection handling for better performance and compatibility. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 2743061c-c65e-41ed-bf21-8da6d73315e6 Replit-Commit-Checkpoint-Type: full_checkpoint
This commit is contained in:
1 parent
6b6c25e41e
commit
97f6217dcc
5 files changed
+13
-11
No files matched your search
+1
-1
@@ -32,7 +32,7 @@ if (isProduction && dbUrl && (dbUrl.includes('logiflow-db') || dbUrl.includes('l
|
|||||||
|
|
||||||
// Test connection
|
// Test connection
|
||||||
try {
|
try {
|
||||||
await pool.connect().then(client => {
|
await pool.connect().then((client: any) => {
|
||||||
console.log('✅ PostgreSQL connection test successful');
|
console.log('✅ PostgreSQL connection test successful');
|
||||||
client.release();
|
client.release();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import express, { type Request, Response, NextFunction } from "express";
|
import express, { type Express, type Request, type Response, type NextFunction } from "express";
|
||||||
import { createServer, type Server } from "http";
|
import { createServer, type Server } from "http";
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import { dirname, join } from 'path';
|
import { dirname, join } from 'path';
|
||||||
@@ -40,7 +40,7 @@ app.use((req, res, next) => {
|
|||||||
// Simple production routes
|
// Simple production routes
|
||||||
async function registerProductionRoutes(app: Express): Promise<Server> {
|
async function registerProductionRoutes(app: Express): Promise<Server> {
|
||||||
// Health check endpoint
|
// Health check endpoint
|
||||||
app.get('/api/health', (req, res) => {
|
app.get('/api/health', (req: Request, res: Response) => {
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
status: 'healthy',
|
status: 'healthy',
|
||||||
timestamp: new Date().toISOString(),
|
timestamp: new Date().toISOString(),
|
||||||
@@ -53,7 +53,7 @@ async function registerProductionRoutes(app: Express): Promise<Server> {
|
|||||||
setupLocalAuth(app);
|
setupLocalAuth(app);
|
||||||
|
|
||||||
// Basic API routes for production
|
// Basic API routes for production
|
||||||
app.get('/api/groups', requireAuth, async (req, res) => {
|
app.get('/api/groups', requireAuth, async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
const groups = await storage.getGroups();
|
const groups = await storage.getGroups();
|
||||||
res.json(groups);
|
res.json(groups);
|
||||||
@@ -63,7 +63,7 @@ async function registerProductionRoutes(app: Express): Promise<Server> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/api/suppliers', requireAuth, async (req, res) => {
|
app.get('/api/suppliers', requireAuth, async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
const suppliers = await storage.getSuppliers();
|
const suppliers = await storage.getSuppliers();
|
||||||
res.json(suppliers);
|
res.json(suppliers);
|
||||||
@@ -73,7 +73,7 @@ async function registerProductionRoutes(app: Express): Promise<Server> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/api/orders', requireAuth, async (req, res) => {
|
app.get('/api/orders', requireAuth, async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
const orders = await storage.getOrders();
|
const orders = await storage.getOrders();
|
||||||
res.json(orders);
|
res.json(orders);
|
||||||
@@ -84,7 +84,7 @@ async function registerProductionRoutes(app: Express): Promise<Server> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Weather API for compatibility
|
// Weather API for compatibility
|
||||||
app.get('/api/weather', async (req, res) => {
|
app.get('/api/weather', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
const weatherData = {
|
const weatherData = {
|
||||||
today: {
|
today: {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ async function createDefaultAdminUser() {
|
|||||||
await storage.updateUser(existingAdmin.id, { password: newHashedPassword });
|
await storage.updateUser(existingAdmin.id, { password: newHashedPassword });
|
||||||
console.log('✅ Admin password migrated to new format');
|
console.log('✅ Admin password migrated to new format');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('⚠️ Could not migrate password, will try multiple formats:', error.message);
|
console.log('⚠️ Could not migrate password, will try multiple formats:', (error as Error).message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -452,7 +452,7 @@ export class DatabaseStorage implements IStorage {
|
|||||||
where: groupIds ? inArray(deliveries.groupId, groupIds) : undefined,
|
where: groupIds ? inArray(deliveries.groupId, groupIds) : undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
return results.map(result => ({
|
return results.map((result: any) => ({
|
||||||
...result,
|
...result,
|
||||||
order: result.order || undefined,
|
order: result.order || undefined,
|
||||||
}));
|
}));
|
||||||
|
|||||||
+4
-2
@@ -5,14 +5,16 @@
|
|||||||
"incremental": true,
|
"incremental": true,
|
||||||
"tsBuildInfoFile": "./node_modules/typescript/tsbuildinfo",
|
"tsBuildInfoFile": "./node_modules/typescript/tsbuildinfo",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"module": "ESNext",
|
"target": "ES2020",
|
||||||
|
"module": "ES2022",
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"lib": ["esnext", "dom", "dom.iterable"],
|
"lib": ["ES2020", "dom", "dom.iterable"],
|
||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
|
"downlevelIteration": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"types": ["node", "vite/client"],
|
"types": ["node", "vite/client"],
|
||||||
"paths": {
|
"paths": {
|
||||||
|
|||||||
Reference in new issue
Block a user