本文整理匯總了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);
}