Fix jwt-token

This commit is contained in:
2025-09-10 07:00:29 +02:00
parent ad3b95646a
commit 9de2135ca3
2 changed files with 169 additions and 3 deletions

View File

@@ -27,7 +27,7 @@ router.get('/debug-test', (req, res) => {
// Get recent detection payloads with raw data
router.get('/detection-payloads', authenticateToken, async (req, res) => {
try {
const { limit = 50, offset = 0, device_id } = req.query;
const { limit = 50, offset = 0, device_id, detection_id } = req.query;
const whereClause = {
raw_payload: { [Op.ne]: null }
@@ -37,6 +37,10 @@ router.get('/detection-payloads', authenticateToken, async (req, res) => {
whereClause.device_id = device_id;
}
if (detection_id) {
whereClause.id = detection_id;
}
const detections = await DroneDetection.findAll({
where: whereClause,
order: [['server_timestamp', 'DESC']],
@@ -44,7 +48,7 @@ router.get('/detection-payloads', authenticateToken, async (req, res) => {
offset: parseInt(offset),
attributes: [
'id', 'device_id', 'drone_id', 'drone_type', 'rssi', 'freq',
'server_timestamp', 'device_timestamp', 'raw_payload'
'server_timestamp', 'device_timestamp', 'raw_payload', 'confidence_level', 'signal_duration', 'geo_lat', 'geo_lon'
]
});