feat: add graphql support (#349)
* fix: eslint warnings * refactor: use ramda + sanctuary instead of lodash * refactor: use prettier-standard for formatting * feat: enable security * feat: add graphql * chore: remove trailing commas from linter * docs: new scripts on react and new-admin-server * feat: handle authentication on graphql * fix: perf improvement to date picker * chore: add insecure-dev script to run servers
This commit is contained in:
parent
49f434f1d1
commit
b8e0c2175b
182 changed files with 8827 additions and 4623 deletions
13
lib/logs.js
13
lib/logs.js
|
|
@ -95,4 +95,15 @@ function getMachineLogs (deviceId, until = new Date().toISOString()) {
|
|||
}))
|
||||
}
|
||||
|
||||
module.exports = { getUnlimitedMachineLogs, getMachineLogs, update, getLastSeen, clearOldLogs }
|
||||
function simpleGetMachineLogs (deviceId, until = new Date().toISOString()) {
|
||||
const sql = `select id, log_level, timestamp, message from logs
|
||||
where device_id=$1
|
||||
and timestamp <= $3
|
||||
order by timestamp desc, serial desc
|
||||
limit $2`
|
||||
|
||||
return db.any(sql, [ deviceId, NUM_RESULTS, until ])
|
||||
.then(_.map(_.mapKeys(_.camelCase)))
|
||||
}
|
||||
|
||||
module.exports = { getUnlimitedMachineLogs, getMachineLogs, simpleGetMachineLogs, update, getLastSeen, clearOldLogs }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue