Merge pull request #39 from akcoder/master
Return task object when a task is created
This commit is contained in:
commit
3b9fce4374
2 files changed
+9
-9
No files matched your search
+8
-8
@@ -196,21 +196,21 @@ listener = (request, response) ->
|
|||||||
if urlParts.query.connection_request?
|
if urlParts.query.connection_request?
|
||||||
apiFunctions.connectionRequest(deviceId, (err) ->
|
apiFunctions.connectionRequest(deviceId, (err) ->
|
||||||
if err
|
if err
|
||||||
response.writeHead(202)
|
response.writeHead(202, {'Content-Type' : 'application/json'})
|
||||||
response.end()
|
response.end(JSON.stringify(task))
|
||||||
else
|
else
|
||||||
apiFunctions.watchTask(task._id, config.get('DEVICE_ONLINE_THRESHOLD', deviceId), (err) ->
|
apiFunctions.watchTask(task._id, config.get('DEVICE_ONLINE_THRESHOLD', deviceId), (err) ->
|
||||||
if err
|
if err
|
||||||
response.writeHead(202)
|
response.writeHead(202, {'Content-Type' : 'application/json'})
|
||||||
response.end()
|
response.end(JSON.stringify(task))
|
||||||
return
|
return
|
||||||
response.writeHead(200)
|
response.writeHead(200, {'Content-Type' : 'application/json'})
|
||||||
response.end()
|
response.end(JSON.stringify(task))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
response.writeHead(202)
|
response.writeHead(202, {'Content-Type' : 'application/json'})
|
||||||
response.end()
|
response.end(JSON.stringify(task))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
else if urlParts.query.connection_request?
|
else if urlParts.query.connection_request?
|
||||||
|
|||||||
+1
-1
@@ -76,7 +76,7 @@ this.refreshObject = (task, methodResponse, callback) ->
|
|||||||
delete task.session.parameterNames
|
delete task.session.parameterNames
|
||||||
|
|
||||||
this.getParameterValues(task.session.subtask, {}, (err, status, methodRequest) ->
|
this.getParameterValues(task.session.subtask, {}, (err, status, methodRequest) ->
|
||||||
# ignore deviceUpdates returned by firt call to getParameterValues
|
# ignore deviceUpdates returned by first call to getParameterValues
|
||||||
callback(err, status, methodRequest, deviceUpdates)
|
callback(err, status, methodRequest, deviceUpdates)
|
||||||
)
|
)
|
||||||
else if status & STATUS_OK
|
else if status & STATUS_OK
|
||||||
|
|||||||
Reference in new issue
Block a user