Fix jwt-token

This commit is contained in:
2025-09-17 20:05:46 +02:00
parent 571634642b
commit 5d61bb50ed
4 changed files with 41 additions and 38 deletions

View File

@@ -226,6 +226,9 @@ router.get('/debug', authenticateToken, async (req, res) => {
include: [{
model: Device,
as: 'device',
where: {
tenant_id: req.user.tenant_id // 🔒 SECURITY: Filter by user's tenant
},
attributes: ['id', 'name', 'location_description', 'geo_lat', 'geo_lon', 'tenant_id']
}],
limit: parseInt(limit),
@@ -243,6 +246,8 @@ router.get('/debug', authenticateToken, async (req, res) => {
};
});
console.log(`🔒 Admin debug: Retrieved ${detections.count} detections for tenant ${req.user.tenant_id}`);
res.json({
success: true,
data: enhancedDetections,