Fix jwt-token
This commit is contained in:
@@ -17,7 +17,7 @@ router.get('/', authenticateToken, async (req, res) => {
|
||||
end_date,
|
||||
page = 1,
|
||||
limit = 50,
|
||||
sort = 'timestamp',
|
||||
sort = 'server_timestamp',
|
||||
order = 'desc'
|
||||
} = req.query;
|
||||
|
||||
@@ -33,11 +33,11 @@ router.get('/', authenticateToken, async (req, res) => {
|
||||
}
|
||||
|
||||
if (start_date) {
|
||||
whereClause.timestamp = { ...whereClause.timestamp, gte: new Date(start_date) };
|
||||
whereClause.server_timestamp = { ...whereClause.server_timestamp, gte: new Date(start_date) };
|
||||
}
|
||||
|
||||
if (end_date) {
|
||||
whereClause.timestamp = { ...whereClause.timestamp, lte: new Date(end_date) };
|
||||
whereClause.server_timestamp = { ...whereClause.server_timestamp, lte: new Date(end_date) };
|
||||
}
|
||||
|
||||
// Calculate offset for pagination
|
||||
@@ -49,7 +49,7 @@ router.get('/', authenticateToken, async (req, res) => {
|
||||
include: [{
|
||||
model: Device,
|
||||
as: 'device',
|
||||
attributes: ['id', 'device_name', 'device_type', 'location', 'latitude', 'longitude']
|
||||
attributes: ['id', 'name', 'geo_lat', 'geo_lon', 'location_description', 'is_approved']
|
||||
}],
|
||||
order: [[sort, order.toUpperCase()]],
|
||||
limit: parseInt(limit),
|
||||
@@ -108,7 +108,7 @@ router.get('/:id', authenticateToken, async (req, res) => {
|
||||
include: [{
|
||||
model: Device,
|
||||
as: 'device',
|
||||
attributes: ['id', 'device_name', 'device_type', 'location', 'latitude', 'longitude']
|
||||
attributes: ['id', 'name', 'geo_lat', 'geo_lon', 'location_description', 'is_approved']
|
||||
}]
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user