mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 15:53:23 +02:00
Modify APIs from Aysnc -> Sync using timeout
This commit is contained in:
@@ -49,24 +49,22 @@ function getDeviceBySerial(req, res) {
|
||||
|
||||
dbapi.loadDevice(serial)
|
||||
.then(function(device) {
|
||||
if (device) {
|
||||
datautil.normalize(device, req.user)
|
||||
|
||||
if(fields) {
|
||||
device = _.pick(device, fields.split(','))
|
||||
}
|
||||
|
||||
res.json({
|
||||
success: true
|
||||
, device: device
|
||||
})
|
||||
}
|
||||
else {
|
||||
res.status(404).json({
|
||||
if (!device) {
|
||||
return res.status(404).json({
|
||||
success: false
|
||||
, description: 'Device not found'
|
||||
})
|
||||
}
|
||||
|
||||
datautil.normalize(device, req.user)
|
||||
if(fields) {
|
||||
device = _.pick(device, fields.split(','))
|
||||
}
|
||||
|
||||
res.json({
|
||||
success: true
|
||||
, device: device
|
||||
})
|
||||
})
|
||||
.catch(function(err) {
|
||||
log.error('Failed to load device "%s": ', req.params.serial, err.stack)
|
||||
|
||||
Reference in New Issue
Block a user