fetch(req, res, next, id) {
   this.storyRepository.findById(id)
     .onFulfill((story) => {
       if (!story) {
         next(new ModelNotFoundError(id));
       } else {
         req.story = story;
         next();
       }
     }).onReject(next);
 }
 remove(req, res, next) {
   this.storyRepository.remove(req.story)
     .onFulfill(() => {
       res.json({statusCode: 200});
     }).onReject(next);
 }
 update(req, res, next) {
   this.storyRepository.update(req.story, req.body)
     .onFulfill((story) => {
       res.json({result: story, statusCode: 200});
     }).onReject(next);
 }
 all(req, res, next) {
   this.storyRepository.all()
     .onFulfill((stories) => {
       res.json({result: stories, statusCode: 200});
     }).onReject(next);
 }
Example #5
0
 remove(req, res, next) {
   this.storyRepository.remove(req.story)
     .onFulfill((story) => {
       res.json(story);
     }).onReject(next);
 }
Example #6
0
 update(req, res, next) {
   this.storyRepository.update(req.story, req.body)
     .onFulfill((story) => {
       res.json(story);
     }).onReject(next);
 }
Example #7
0
 index(req, res, next) {
   this.storyRepository.all()
     .onFulfill((stories) => {
       res.json(stories);
     }).onReject(next);
 }