mirror of
https://github.com/Roslund/meshtastic-map.git
synced 2026-03-28 17:43:03 +01:00
Filter nodes and hardware models to include only those updated in the last 30 days
This commit is contained in:
@@ -219,6 +219,10 @@ app.get('/api/v1/nodes', async (req, res) => {
|
||||
where: {
|
||||
role: role,
|
||||
hardware_model: hardwareModel,
|
||||
// Since we removed retention; only include nodes that have been updated in the last 30 days
|
||||
updated_at: {
|
||||
gte: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000) // within last 30 days
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -21,6 +21,12 @@ router.get('/hardware-models', async (req, res) => {
|
||||
// get nodes from db
|
||||
const results = await prisma.node.groupBy({
|
||||
by: ['hardware_model'],
|
||||
where: {
|
||||
// Since we removed retention; only include nodes that have been updated in the last 30 days
|
||||
updated_at: {
|
||||
gte: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000) // within last 30 days
|
||||
}
|
||||
},
|
||||
orderBy: {
|
||||
_count: {
|
||||
hardware_model: 'desc',
|
||||
|
||||
Reference in New Issue
Block a user