Fix jwt-token
This commit is contained in:
@@ -11,9 +11,6 @@ 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,
|
||||||
@@ -47,13 +44,6 @@ 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,
|
||||||
@@ -64,8 +54,7 @@ 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
|
||||||
|
|||||||
Reference in New Issue
Block a user