support for specifiyng host

This commit is contained in:
cupcakearmy 2020-09-20 17:43:39 +02:00
parent 88ebc6b5dd
commit 45d09a41ce
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9
1 changed files with 7 additions and 4 deletions

View File

@ -5,14 +5,17 @@ import { Logs } from '../shared/db'
export async function data({ start, end }) {
const logs = await getLogsBetweenDates({ start, end })
console.log('Found', logs.length)
return groupBy(logs, 'host')
}
export async function getLogsBetweenDates({ start, end }) {
return await Logs.find({
export async function getLogsBetweenDates({ start, end, host }) {
const where = {
$and: [{ timestamp: { $gt: start } }, { timestamp: { $lt: end } }],
})
}
console.log(host)
if (host) where.host = host
console.log('Where', where)
return await Logs.find(where)
}
export function countInGroup(grouped) {