-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtasks.js
More file actions
23 lines (21 loc) · 682 Bytes
/
Copy pathtasks.js
File metadata and controls
23 lines (21 loc) · 682 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module.exports = function tasks() {
const seneca = this;
seneca.add({role: 'tasks', cmd: 'create' }, function (msg,done){
seneca.make$('tasks',msg.task).save$(done);
});
seneca.add({role: 'tasks', cmd: 'check' }, function (msg,done){
seneca.make$('tasks').load$({id:msg.id}, (error,task) =>{
if(error) {
done(error);
} else {
task.data$({checked: msg.checked}).save$(done);
}
});
});
seneca.add({role: 'tasks', cmd: 'remove' }, function (msg,done){
seneca.make$('tasks').remove$({id: msg.id },done);
});
seneca.add({role: 'tasks', cmd: 'list' }, function (msg,done){
seneca.make$('tasks').list$(done);
});
};