Guest User

Untitled

a guest
Feb 3rd, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. export interface User extends Document {
  2. email: string;
  3. password: string;
  4. }
  5.  
  6. export const UserSchema: Schema = new Schema({
  7. ...
  8. });
  9.  
  10. UserSchema.methods.checkPassword = function(...){...};
  11.  
  12. async findOneByEmail(email: string): Promise<User | null> {
  13. const userModel = await this.userModel.findOne({ email }).exec();
  14. return userModel;
  15. }
  16.  
  17. const user = await this.usersService.findOneByEmail(email);
  18. if (!user) throw new UnauthorizedException();
  19. userToAttempt.checkPassword(...
  20.  
  21. export interface User extends Document {
  22. email: string;
  23. password: string;
  24.  
  25. checkPassword(...): any;
  26. }
Add Comment
Please, Sign In to add comment