本文整理汇总了TypeScript中server/repositories/user/user-repository.d.IUserRepository类的典型用法代码示例。如果您正苦于以下问题:TypeScript d.IUserRepository类的具体用法?TypeScript d.IUserRepository怎么用?TypeScript d.IUserRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了d.IUserRepository类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ModelNotFoundError
fetch(req, res, next, id) {
this.userRepository.findById(id)
.onFulfill((user) => {
if(! user) {
throw new ModelNotFoundError(id);
}
req.fetchedUser = user;
next();
}).onReject(next);
}
示例2: createSuperUser
private createSuperUser() {
let superUser: IUser = {
display_name: "Kareem Mohamed",
username: "kareem",
local: {
email: "kareem3d.a@gmail.com",
password: "kareem123",
fname: "Kareem",
lname: "Mohamed",
validated: true
}
};
return this.userRepository.create(superUser);
}
示例3: authenticateLocal
authenticateLocal(attributes) {
// Authenticate local user
let {email, password} = attributes;
return this.userRepository.checkLocal(email, password);
}
示例4: addAdminRole
private addAdminRole(user, shop) {
return this.userRepository.addRoleByUsername(user.username, {
role: "admin",
shop_id: shop._id
});
}
示例5:
.then(user_id => this.userRepository.findById(user_id))
示例6: all
all(req, res, next) {
this.userRepository.find(req.query)
.onFulfill((users) => {
this.successResponse(res, users);
}).onReject(next);
}