fix: Remaining TypeScript strict mode errors in routes

This commit is contained in:
2026-02-04 23:19:32 +00:00
parent 7be99098f5
commit f4160b60f9
6 changed files with 294 additions and 7 deletions

View File

@@ -54,7 +54,7 @@ router.post('/collect', async (_req: Request, res: Response) => {
try {
const result = await collectAllMetrics()
res.json({
success: true,
ok: true,
message: `Recolhidas métricas: ${result.success} OK, ${result.failed} falharam`,
...result
})
@@ -70,7 +70,7 @@ router.post('/collect', async (_req: Request, res: Response) => {
// POST /api/hetzner/collect/:hetzner_id - Recolher métricas de um servidor específico
router.post('/collect/:hetzner_id', async (req: Request, res: Response) => {
try {
const hetzner_id = parseInt(req.params.hetzner_id)
const hetzner_id = parseInt(String(req.params.hetzner_id))
if (isNaN(hetzner_id)) {
return res.status(400).json({
success: false,
@@ -95,7 +95,7 @@ router.post('/collect/:hetzner_id', async (req: Request, res: Response) => {
// GET /api/hetzner/history/:server_id - Histórico de métricas para gráficos
router.get('/history/:server_id', async (req: Request, res: Response) => {
try {
const server_id = parseInt(req.params.server_id)
const server_id = parseInt(String(req.params.server_id))
const hours = parseInt(req.query.hours as string) || 24
if (isNaN(server_id)) {