fix: resolve all TypeScript errors - node types, Express v4 types, places/scheduler fixes
This commit is contained in:
@@ -94,7 +94,7 @@ router.put('/users/:id', (req: Request, res: Response) => {
|
||||
|
||||
router.delete('/users/:id', (req: Request, res: Response) => {
|
||||
const authReq = req as AuthRequest;
|
||||
if (parseInt(req.params.id) === authReq.user.id) {
|
||||
if (parseInt(req.params.id as string) === authReq.user.id) {
|
||||
return res.status(400).json({ error: 'Cannot delete own account' });
|
||||
}
|
||||
|
||||
|
||||
@@ -41,12 +41,12 @@ router.get('/', authenticate, requireTripAccess, (req: Request, res: Response) =
|
||||
|
||||
if (category) {
|
||||
query += ' AND p.category_id = ?';
|
||||
params.push(category);
|
||||
params.push(category as string);
|
||||
}
|
||||
|
||||
if (tag) {
|
||||
query += ' AND p.id IN (SELECT place_id FROM place_tags WHERE tag_id = ?)';
|
||||
params.push(tag);
|
||||
params.push(tag as string);
|
||||
}
|
||||
|
||||
query += ' ORDER BY p.created_at DESC';
|
||||
@@ -107,7 +107,7 @@ router.post('/', authenticate, requireTripAccess, validateStringLengths({ name:
|
||||
}
|
||||
}
|
||||
|
||||
const place = getPlaceWithTags(placeId);
|
||||
const place = getPlaceWithTags(Number(placeId));
|
||||
res.status(201).json({ place });
|
||||
broadcast(tripId, 'place:created', { place }, req.headers['x-socket-id'] as string);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import cron from 'node-cron';
|
||||
import cron, { type ScheduledTask } from 'node-cron';
|
||||
import archiver from 'archiver';
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
@@ -23,7 +23,7 @@ interface BackupSettings {
|
||||
keep_days: number;
|
||||
}
|
||||
|
||||
let currentTask: cron.ScheduledTask | null = null;
|
||||
let currentTask: ScheduledTask | null = null;
|
||||
|
||||
function loadSettings(): BackupSettings {
|
||||
try {
|
||||
@@ -110,7 +110,7 @@ function start(): void {
|
||||
}
|
||||
|
||||
// Demo mode: hourly reset of demo user data
|
||||
let demoTask: cron.ScheduledTask | null = null;
|
||||
let demoTask: ScheduledTask | null = null;
|
||||
|
||||
function startDemoReset(): void {
|
||||
if (demoTask) { demoTask.stop(); demoTask = null; }
|
||||
|
||||
Reference in New Issue
Block a user