Initial version of transactions. Shell command implemented as an example. Still needs channel cleanup on app side, handling a device dying in the middle of a transaction, and getting device list back to normal.

This commit is contained in:
Simo Kinnunen
2014-02-21 11:43:51 +09:00
parent 84207e1f36
commit 8769b8040c
19 changed files with 433 additions and 181 deletions

View File

@@ -1,5 +1,6 @@
var oboe = require('oboe')
var _ = require('lodash')
var Promise = require('bluebird')
module.exports = function DeviceServiceFactory($rootScope, $http, socket) {
var deviceService = {
@@ -69,6 +70,13 @@ module.exports = function DeviceServiceFactory($rootScope, $http, socket) {
insert(device)
})
deviceService.list = function () {
return $http.get('/api/v1/devices')
.then(function(response) {
return response.data.devices
})
}
deviceService.get = function (serial) {
return $http.get('/api/v1/devices/' + serial)
.then(function (response) {