Fix jwt-token

This commit is contained in:
2025-08-28 12:00:59 +02:00
parent b7a7fcd379
commit 4ecb2f65a8

View File

@@ -11,6 +11,9 @@ const router = express.Router();
*/ */
router.get('/', authenticateToken, async (req, res) => { router.get('/', authenticateToken, async (req, res) => {
try { try {
console.log('🔍 DETECTIONS ROUTE HIT - req.url:', req.originalUrl);
console.log('🔍 Query params:', req.query);
const { const {
device_id, device_id,
drone_id, drone_id,
@@ -44,6 +47,13 @@ router.get('/', authenticateToken, async (req, res) => {
// Calculate offset for pagination // Calculate offset for pagination
const offset = (parseInt(page) - 1) * parseInt(limit); const offset = (parseInt(page) - 1) * parseInt(limit);
console.log('🔍 About to query with whereClause:', whereClause);
console.log('🔍 Include config:', {
model: 'Device',
as: 'device',
attributes: ['id', 'name', 'geo_lat', 'geo_lon', 'location_description', 'is_approved']
});
// Query detections with device information // Query detections with device information
const detections = await DroneDetection.findAll({ const detections = await DroneDetection.findAll({
where: whereClause, where: whereClause,
@@ -54,7 +64,8 @@ router.get('/', authenticateToken, async (req, res) => {
}], }],
order: [[sort, order.toUpperCase()]], order: [[sort, order.toUpperCase()]],
limit: parseInt(limit), limit: parseInt(limit),
offset: offset offset: offset,
logging: console.log // Enable SQL logging for this query
}); });
// Get total count for pagination // Get total count for pagination