diff --git a/src/modules/user/user.controller.ts b/src/modules/user/user.controller.ts index 8b84351..5fab8a3 100644 --- a/src/modules/user/user.controller.ts +++ b/src/modules/user/user.controller.ts @@ -75,7 +75,7 @@ export class UserController { @Body() data: UpdateUserFCMTokenDTO, ): Promise> { try { - await this.userService.updateUserById(user.id, data); + await this.userService.updateUserFCMTokenById(user.id, data.FCMToken); return { status: 'success', data: null }; } catch (error) { return { status: 'error', data: null }; diff --git a/src/modules/user/user.service.ts b/src/modules/user/user.service.ts index 1ea9f38..751febd 100644 --- a/src/modules/user/user.service.ts +++ b/src/modules/user/user.service.ts @@ -33,6 +33,16 @@ export class UserService { return data; } + async updateUserFCMTokenById(id: string, FCMToken: string) { + const user = await this.prisma.user.findUnique({ where: { id } }); + if (!user) throw new HttpException('User not found', HttpStatus.NOT_FOUND); + + await this.prisma.user.update({ + where: { id }, + data: { FCMToken }, + }); + } + /** * Update user profile image by id * @param id User id