update: fix

This commit is contained in:
mahyargdz
2025-07-29 12:54:34 +03:30
parent 6b1a9dd7a9
commit 3bf158c433
@@ -33,6 +33,7 @@ export class NotificationsService {
const em = this.em.fork();
try {
await em.begin();
const user = await em.findOne(User, { id: createNotificationDto.recipientId });
if (!user) throw new NotFoundException(UserMessage.USER_NOT_FOUND);
const notification = em.create(Notification, {
@@ -41,7 +42,6 @@ export class NotificationsService {
});
await em.persistAndFlush(notification);
// Send push notification to all user devices if user has push tokens
if (user.pushTokens && user.pushTokens.length > 0) {
await this.sendPushNotificationToUserDevices(user.id, user.pushTokens, {
title: createNotificationDto.title,