From 7ac3f0cc6a33d9bae23119f67b47c7100f50e85a Mon Sep 17 00:00:00 2001 From: vchikalkin Date: Fri, 12 Jan 2024 13:54:10 +0300 Subject: [PATCH] apps/api: update: return updated account --- apps/api/src/account/account.service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/api/src/account/account.service.ts b/apps/api/src/account/account.service.ts index 8499250..f4d5181 100644 --- a/apps/api/src/account/account.service.ts +++ b/apps/api/src/account/account.service.ts @@ -46,7 +46,9 @@ export class AccountService { 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) { @@ -75,7 +77,7 @@ export class AccountService { try { const { username } = this.jwtService.verify(token) as TokenPayload; - return this.accountModel.find({ + return this.accountModel.findOne({ username, }); } catch {