fix: TypeScript strict mode errors in server and services
This commit is contained in:
@@ -22,7 +22,7 @@ app.use(cors({
|
|||||||
app.use(express.json())
|
app.use(express.json())
|
||||||
|
|
||||||
// Health check
|
// Health check
|
||||||
app.get('/api/health', (req, res) => {
|
app.get('/api/health', (_req, res) => {
|
||||||
res.json({ status: 'ok', timestamp: new Date().toISOString() })
|
res.json({ status: 'ok', timestamp: new Date().toISOString() })
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ app.use('/api/hetzner', hetznerRouter)
|
|||||||
app.use('/api/wp-monitor', wpMonitorRouter)
|
app.use('/api/wp-monitor', wpMonitorRouter)
|
||||||
|
|
||||||
// Error handling
|
// Error handling
|
||||||
app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => {
|
app.use((err: any, _req: express.Request, res: express.Response, _next: express.NextFunction) => {
|
||||||
console.error('Server error:', err)
|
console.error('Server error:', err)
|
||||||
res.status(500).json({ error: 'Internal server error' })
|
res.status(500).json({ error: 'Internal server error' })
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ async function hetznerRequest<T>(endpoint: string): Promise<T> {
|
|||||||
throw new Error(`Hetzner API error: ${response.status} ${response.statusText}`)
|
throw new Error(`Hetzner API error: ${response.status} ${response.statusText}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return response.json()
|
return response.json() as Promise<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sincronizar lista de servidores
|
// Sincronizar lista de servidores
|
||||||
|
|||||||
@@ -143,11 +143,11 @@ export async function getMonitoringData() {
|
|||||||
GROUP BY category
|
GROUP BY category
|
||||||
`)
|
`)
|
||||||
|
|
||||||
// Parse details JSON
|
// Parse details JSON and cast to MonitoringItem
|
||||||
const itemsParsed = items.map(item => ({
|
const itemsParsed: MonitoringItem[] = items.map(item => ({
|
||||||
...item,
|
...item,
|
||||||
details: typeof item.details === 'string' ? JSON.parse(item.details) : item.details
|
details: typeof item.details === 'string' ? JSON.parse(item.details) : item.details
|
||||||
}))
|
} as MonitoringItem))
|
||||||
|
|
||||||
// Organize by category
|
// Organize by category
|
||||||
const data: Record<string, MonitoringItem[]> = {}
|
const data: Record<string, MonitoringItem[]> = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user