本文整理汇总了TypeScript中server/repositories/shop/shop-repository.d.IShopRepository类的典型用法代码示例。如果您正苦于以下问题:TypeScript d.IShopRepository类的具体用法?TypeScript d.IShopRepository怎么用?TypeScript d.IShopRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了d.IShopRepository类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createTestShop
private createTestShop(user) {
let testShop: IShop = {
name: "test",
creator_id: user
};
return this.shopRepository.create(testShop);
}
示例2: ModelNotFoundError
fetch(req, res, next, id) {
this.shopRepository.findById(id)
.onFulfill((shop) => {
if(! shop) {
throw new ModelNotFoundError(id);
}
req.fetchedShop = shop;
next();
}).onReject(next);
}
示例3: next
setShop(req, res, next) {
let shopId = this.getShopId(req);
if(! shopId) {
return next();
}
this.shopRepository.findById(shopId)
.then((shop) => {
req.shop = shop;
next();
})
// Don't fail if error happened
.then(null, next);
}
示例4: all
all(req, res, next) {
this.shopRepository.find(req.query)
.onFulfill((shops) => {
this.successResponse(res, shops);
}).onReject(next);
}