[data] updated 0.0.1 -> 0.0.2

This commit is contained in:
tmshv committed 2017-01-03 06:30:03 +03:00
1 parent e9cb52d20b
commit e9ac51d675
7 files changed
+152 -81

No files matched your search

+29 -33
View File
@@ -2,47 +2,43 @@ import Data from './Data';
export default class Schedule extends Data {
create(){
create() {
}
}
read(){
read() {
}
}
update(){
delete() {
}
}
delete(){
find(query) {
}
}
find(query){
add(post) {
let savePost = async(post) => {
const id = post.id;
const type = post.type;
const query = {id: id, type: type};
}
await this.store.update(query, post, {upsert: true});
let document = await this.store.find(query).limit(1).toArray();
return document[0];
};
add(post) {
let savePost = async(post) => {
const id = post.id;
const type = post.type;
const query = {id: id, type: type};
await this.store.update(query, post, {upsert: true});
let document = await this.store.find(query).limit(1).toArray();
return document[0];
};
let add = async(post) => {
let document = post;
if(this.save){
document = await savePost(post);
}
this.update(document);
return document;
};
return add(post);
}
let add = async(post) => {
let document = post;
if (this.save) {
document = await savePost(post);
}
this.broadcast(document);
return document;
};
return add(post);
}
}