Provide machine name on logs snapshots batch
This commit is contained in:
parent
62d606cc80
commit
4f9cc88a5e
4 changed files with 819 additions and 273 deletions
|
|
@ -203,51 +203,26 @@ app.get('/api/logs', (req, res, next) => {
|
|||
.catch(next)
|
||||
})
|
||||
|
||||
/**
|
||||
* Get support_logs for the last 2 days
|
||||
*
|
||||
* @name get
|
||||
* @function
|
||||
* @async
|
||||
*
|
||||
* @param {string} '/api/support_logs/ URl to handle
|
||||
* @param {object} req Request object
|
||||
* @param {object} res Response object
|
||||
* @param {function} next Callback
|
||||
*/
|
||||
app.get('/api/support_logs/:timestamp', (req, res, next) => {
|
||||
const timestamp = req.params.timestamp || new Date().toISOString()
|
||||
return supportLogs.batch(timestamp)
|
||||
app.get('/api/support_logs', (req, res, next) => {
|
||||
return supportLogs.batch()
|
||||
.then(supportLogs => res.send({ supportLogs }))
|
||||
.catch(next)
|
||||
})
|
||||
|
||||
app.get('/api/support_logs/logs', (req, res, next) => {
|
||||
return supportLogs.get(req.query.supportLogId)
|
||||
.then(log => (!_.isNil(log) && !_.isEmpty(log)) ? log : supportLogs.batch().then(_.first))
|
||||
.then(log => logs.getMachineLogs(log.deviceId, log.timestamp))
|
||||
.then(r => res.send(r))
|
||||
.catch(next)
|
||||
})
|
||||
|
||||
/**
|
||||
* Create a new support log
|
||||
*
|
||||
* @name post
|
||||
* @function
|
||||
* @async
|
||||
*
|
||||
* @param {string} '/api/support_logs' URL Endpoint
|
||||
* @param {object} req Request object
|
||||
* @param {object} res Response object
|
||||
* @param {function} next Callback
|
||||
*/
|
||||
app.post('/api/support_logs', (req, res, next) => {
|
||||
return supportLogs.insert(req.query.deviceId)
|
||||
.then(r => res.send(r))
|
||||
.catch(next)
|
||||
})
|
||||
|
||||
/**
|
||||
* Endpoint for patching customer's data
|
||||
*
|
||||
* @param {string} '/api/customer/ Url to handle
|
||||
* @param {object} req Request object
|
||||
* @param {object} res Response object
|
||||
* @param {function} next Callback
|
||||
*/
|
||||
app.patch('/api/customer/:id', (req, res, next) => {
|
||||
if (!req.params.id) return res.status(400).send({Error: 'Requires id'})
|
||||
const token = req.token || req.cookies.token
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue