Semaphore/public/js/factories/identity.js
2014-09-11 18:42:13 +01:00

29 lines
585 B
JavaScript

define(['app'], function (app) {
app.registerFactory('Identity', ['$http', function ($http) {
var Model = function (id) {
if (!id) {
return;
}
this.id = id;
}
Model.prototype.save = function () {
return $http.put('/identity/'+this.data._id, this.data);
}
Model.prototype.add = function () {
return $http.post('/identities', this.data);
}
Model.prototype.delete = function () {
return $http.delete('/identity/'+this.data._id);
}
Model.prototype.get = function () {
return $http.get('/identity/'+this.id);
}
return Model;
}])
})