Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- export interface User extends Document {
- email: string;
- password: string;
- }
- export const UserSchema: Schema = new Schema({
- ...
- });
- UserSchema.methods.checkPassword = function(...){...};
- async findOneByEmail(email: string): Promise<User | null> {
- const userModel = await this.userModel.findOne({ email }).exec();
- return userModel;
- }
- const user = await this.usersService.findOneByEmail(email);
- if (!user) throw new UnauthorizedException();
- userToAttempt.checkPassword(...
- export interface User extends Document {
- email: string;
- password: string;
- checkPassword(...): any;
- }
Add Comment
Please, Sign In to add comment