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:
michaelschal committed 2025-08-11 15:23:06 +00:00
1 parent 6b6c25e41e
commit 97f6217dcc
5 files changed
+13 -11

No files matched your search

+1 -1
View File
@@ -32,7 +32,7 @@ if (isProduction && dbUrl && (dbUrl.includes('logiflow-db') || dbUrl.includes('l
// Test connection
try {
await pool.connect().then(client => {
await pool.connect().then((client: any) => {
console.log('✅ PostgreSQL connection test successful');
client.release();
});
+6 -6
View File
@@ -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 { fileURLToPath } from 'url';
import { dirname, join } from 'path';
@@ -40,7 +40,7 @@ app.use((req, res, next) => {
// Simple production routes
async function registerProductionRoutes(app: Express): Promise<Server> {
// Health check endpoint
app.get('/api/health', (req, res) => {
app.get('/api/health', (req: Request, res: Response) => {
res.status(200).json({
status: 'healthy',
timestamp: new Date().toISOString(),
@@ -53,7 +53,7 @@ async function registerProductionRoutes(app: Express): Promise<Server> {
setupLocalAuth(app);
// Basic API routes for production
app.get('/api/groups', requireAuth, async (req, res) => {
app.get('/api/groups', requireAuth, async (req: Request, res: Response) => {
try {
const groups = await storage.getGroups();
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 {
const suppliers = await storage.getSuppliers();
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 {
const orders = await storage.getOrders();
res.json(orders);
@@ -84,7 +84,7 @@ async function registerProductionRoutes(app: Express): Promise<Server> {
});
// Weather API for compatibility
app.get('/api/weather', async (req, res) => {
app.get('/api/weather', async (req: Request, res: Response) => {
try {
const weatherData = {
today: {
+1 -1
View File
@@ -107,7 +107,7 @@ async function createDefaultAdminUser() {
await storage.updateUser(existingAdmin.id, { password: newHashedPassword });
console.log('✅ Admin password migrated to new format');
} 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
View File
@@ -452,7 +452,7 @@ export class DatabaseStorage implements IStorage {
where: groupIds ? inArray(deliveries.groupId, groupIds) : undefined,
});
return results.map(result => ({
return results.map((result: any) => ({
...result,
order: result.order || undefined,
}));
+4 -2
View File
@@ -5,14 +5,16 @@
"incremental": true,
"tsBuildInfoFile": "./node_modules/typescript/tsbuildinfo",
"noEmit": true,
"module": "ESNext",
"target": "ES2020",
"module": "ES2022",
"strict": true,
"lib": ["esnext", "dom", "dom.iterable"],
"lib": ["ES2020", "dom", "dom.iterable"],
"jsx": "preserve",
"esModuleInterop": true,
"skipLibCheck": true,
"allowImportingTsExtensions": true,
"moduleResolution": "bundler",
"downlevelIteration": true,
"baseUrl": ".",
"types": ["node", "vite/client"],
"paths": {