<commit_before>import { User, IUser } from "../../models/index";
import { Model } from "mongoose";
import {BaseRepository} from '../base/base.repository';
import {IBaseRepository} from '../base/base.repository.interface';
import {IUserRepository} from '../interfaces/user.repository.interface';

export class UserRepository extends BaseRepository<IUser> implements IUserRepository, IBaseRepository<IUser> {
    protected mongooseModelInstance: Model<IUser> = User;
    public constructor(){
        super();
    }

    public async getUserForPasswordCheck(username: string): Promise<IUser>{
        return await this.mongooseModelInstance.findOne({ username: username })
                .select('+passwordHash');
    }

    public async updatePassword(id: string, hashedPassword: string): Promise<IUser>{
        user.passwordHash = hashedPassword;
        return await user.save();
    }
}<commit_msg>adding the password hash to the thing that is selected<commit_after>import { User, IUser } from "../../models/index";
import { Model } from "mongoose";
import {BaseRepository} from '../base/base.repository';
import {IBaseRepository} from '../base/base.repository.interface';
import {IUserRepository} from '../interfaces/user.repository.interface';

export class UserRepository extends BaseRepository<IUser> implements IUserRepository, IBaseRepository<IUser> {
    protected mongooseModelInstance: Model<IUser> = User;
    public constructor(){
        super();
    }

    public async getUserForPasswordCheck(username: string): Promise<IUser>{
        return await this.mongooseModelInstance.findOne({ username: username })
                .select('+passwordHash');
    }

    public async updatePassword(id: string, hashedPassword: string): Promise<IUser>{
        let user: IUser = await this.mongooseModelInstance.findById(id).select('+passwordHash');
        user.passwordHash = hashedPassword;
        return await user.save();
    }
}
{'fraction_non_alphanumeric': 0.12100926879505665, 'fraction_numerical': 0.0, 'mean_word_length': 4.073107049608355, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5553922', 'n_tokens_mistral': 501, 'n_tokens_neox': 502, 'n_words': 132}