Add logs
This commit is contained in:
parent
d127901992
commit
43f578d311
6 changed files with 803 additions and 4009 deletions
|
|
@ -17,6 +17,7 @@ const poller = require('./poller')
|
|||
const Tx = require('./tx')
|
||||
const E = require('./error')
|
||||
const customers = require('./customers')
|
||||
const logs = require('./logs')
|
||||
|
||||
const argv = require('minimist')(process.argv.slice(2))
|
||||
|
||||
|
|
@ -174,6 +175,18 @@ function getCustomerWithPhoneCode (req, res, next) {
|
|||
.catch(next)
|
||||
}
|
||||
|
||||
function getLastSeen (req, res, next) {
|
||||
return logs.getLastSeen(req.deviceId)
|
||||
.then(timestamp => res.json({lastSeen: timestamp}))
|
||||
.catch(next)
|
||||
}
|
||||
|
||||
function updateLogs (req, res, next) {
|
||||
return logs.update(req.deviceId, req.body.logs)
|
||||
.then(status => res.json({success: status}))
|
||||
.catch(next)
|
||||
}
|
||||
|
||||
function ca (req, res) {
|
||||
const token = req.query.token
|
||||
|
||||
|
|
@ -291,6 +304,8 @@ app.post('/phone_code', getCustomerWithPhoneCode)
|
|||
app.post('/tx', postTx)
|
||||
app.get('/tx/:id', getTx)
|
||||
app.get('/tx', getPhoneTx)
|
||||
app.get('/logs', getLastSeen)
|
||||
app.post('/logs', updateLogs)
|
||||
|
||||
app.use(errorHandler)
|
||||
app.use((req, res) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue