This commit is contained in:
tmshv committed 2016-11-11 02:36:03 +03:00
1 parent be398bf5ce
commit f121eff445
38 files changed
+498 -267

No files matched your search

+2
View File
@@ -1,7 +1,9 @@
import Timeline from './Timeline';
import Schedule from './Schedule';
export default class DataManager {
constructor(stores) {
this.timeline = new Timeline(stores.timeline);
this.schedule = new Schedule(stores.schedules);
}
}
+48
View File
@@ -0,0 +1,48 @@
import Data from './Data';
export default class Schedule extends Data {
create(){
}
read(){
}
update(){
}
delete(){
}
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];
};
let add = async(post) => {
let document = post;
if(this.save){
document = await savePost(post);
}
this.update(document);
return document;
};
return add(post);
}
}