chore: add notification service for all user action
This commit is contained in:
@@ -60,6 +60,23 @@ export class UserSettingsService {
|
||||
}
|
||||
//*+*******************************************
|
||||
|
||||
async getUserNotificationSettingWithType(type: NotifType, userId: string, queryRunner?: QueryRunner) {
|
||||
const repository = queryRunner ? queryRunner.manager.getRepository(UserSetting) : this.userSettingsRepository;
|
||||
|
||||
const setting = await repository.findOne({
|
||||
where: { user: { id: userId }, notificationSetting: { type } },
|
||||
relations: {
|
||||
notificationSetting: true,
|
||||
},
|
||||
});
|
||||
|
||||
if (!setting) throw new BadRequestException(SettingMessageEnum.NOT_FOUND);
|
||||
|
||||
return setting;
|
||||
}
|
||||
|
||||
//*+*******************************************
|
||||
|
||||
async toggleUserNotificationSetting(settingId: string) {
|
||||
const setting = await this.userSettingsRepository.findOneBy({ id: settingId });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user