mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +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
|
||||
try {
|
||||
await pool.connect().then(client => {
|
||||
await pool.connect().then((client: any) => {
|
||||
console.log('✅ PostgreSQL connection test successful');
|
||||
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 { 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: {
|
||||
|
||||
@@ -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
@@ -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,
|
||||
}));
|
||||
|
||||
Reference in new issue
Block a user