apps/api: update: return updated account

This commit is contained in:
vchikalkin 2024-01-12 13:54:10 +03:00
parent 0643080e68
commit 7ac3f0cc6a

View File

@ -46,7 +46,9 @@ export class AccountService {
throw new BadRequestException(`Prop ${field} is not allowed`); throw new BadRequestException(`Prop ${field} is not allowed`);
}); });
return this.accountModel.findOneAndUpdate({ username }, props).exec(); this.accountModel.findOneAndUpdate({ username }, props).exec();
return this.accountModel.findOne({ username });
} }
public async login({ login, password }: Credentials) { public async login({ login, password }: Credentials) {
@ -75,7 +77,7 @@ export class AccountService {
try { try {
const { username } = this.jwtService.verify(token) as TokenPayload; const { username } = this.jwtService.verify(token) as TokenPayload;
return this.accountModel.find({ return this.accountModel.findOne({
username, username,
}); });
} catch { } catch {