mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2026-03-10 18:41:46 +00:00
Compare commits
1 Commits
8d56a8da0f
...
feature/no
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ab9554c0c |
@ -1,6 +1,7 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { OnEvent } from '@nestjs/event-emitter';
|
||||
import { I18nService } from 'nestjs-i18n';
|
||||
import { Roles } from '~/auth/enums';
|
||||
import { NotificationFactory, NotificationPreferences } from '../services/notification-factory.service';
|
||||
import { UserService } from '~/user/services/user.service';
|
||||
import { NOTIFICATION_EVENTS } from '../constants/event-names.constant';
|
||||
@ -24,6 +25,14 @@ export class ProfileNotificationListener {
|
||||
try {
|
||||
const { user, updatedFields } = event;
|
||||
|
||||
// Do not notify when a child updates their profile (no notification to child or parent)
|
||||
if (user?.roles?.includes(Roles.JUNIOR)) {
|
||||
this.logger.log(
|
||||
`Skipping profile updated notification for child user ${user.id} - no notification sent`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
this.logger.log(
|
||||
`Processing profile updated notification for user ${user.id} - Updated fields: ${updatedFields.join(', ')}`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user