mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-22 16:20:44 +01:00
29 lines
558 B
JavaScript
29 lines
558 B
JavaScript
define(['app'], function (app) {
|
|
app.registerFactory('Task', ['$http', function ($http) {
|
|
var Task = function (id) {
|
|
if (!id) {
|
|
return;
|
|
}
|
|
|
|
this.id = id;
|
|
}
|
|
|
|
Task.prototype.save = function () {
|
|
return $http.put('/task/'+this.data._id, this.data);
|
|
}
|
|
|
|
Task.prototype.add = function () {
|
|
return $http.post('/tasks', this.data);
|
|
}
|
|
|
|
Task.prototype.delete = function () {
|
|
return $http.delete('/task/'+this.data._id);
|
|
}
|
|
|
|
Task.prototype.get = function () {
|
|
return $http.get('/task/'+this.id);
|
|
}
|
|
|
|
return Task;
|
|
}])
|
|
}) |