本文整理汇总了TypeScript中src/server/models/story/StoryRepository.StoryRepository类的典型用法代码示例。如果您正苦于以下问题:TypeScript StoryRepository类的具体用法?TypeScript StoryRepository怎么用?TypeScript StoryRepository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StoryRepository类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: fetch
fetch(req, res, next, id) {
this.storyRepository.findById(id)
.onFulfill((story) => {
if (!story) {
next(new ModelNotFoundError(id));
} else {
req.story = story;
next();
}
}).onReject(next);
}
示例2: remove
remove(req, res, next) {
this.storyRepository.remove(req.story)
.onFulfill(() => {
res.json({statusCode: 200});
}).onReject(next);
}
示例3: update
update(req, res, next) {
this.storyRepository.update(req.story, req.body)
.onFulfill((story) => {
res.json({result: story, statusCode: 200});
}).onReject(next);
}
示例4: all
all(req, res, next) {
this.storyRepository.all()
.onFulfill((stories) => {
res.json({result: stories, statusCode: 200});
}).onReject(next);
}
示例5: remove
remove(req, res, next) {
this.storyRepository.remove(req.story)
.onFulfill((story) => {
res.json(story);
}).onReject(next);
}
示例6: update
update(req, res, next) {
this.storyRepository.update(req.story, req.body)
.onFulfill((story) => {
res.json(story);
}).onReject(next);
}
示例7: index
index(req, res, next) {
this.storyRepository.all()
.onFulfill((stories) => {
res.json(stories);
}).onReject(next);
}