From 366ab5092eb17aa15ee1681abb2cd2f7deca60cf Mon Sep 17 00:00:00 2001 From: realrafi Date: Sat, 1 Aug 2026 00:20:59 +0330 Subject: [PATCH] refactor: changed notif entity and createDTO --- src/modules/notifications/DTO/create-notification.dto.ts | 2 -- src/modules/notifications/entities/notification.entity.ts | 3 ++- src/modules/notifications/notification.module.ts | 3 +++ src/modules/notifications/providers/notification.service.ts | 2 -- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/modules/notifications/DTO/create-notification.dto.ts b/src/modules/notifications/DTO/create-notification.dto.ts index 802148d..0a59e71 100644 --- a/src/modules/notifications/DTO/create-notification.dto.ts +++ b/src/modules/notifications/DTO/create-notification.dto.ts @@ -27,13 +27,11 @@ export class CreateNotificationDto { description: 'notification subject' }) @IsString() - @IsOptional() subject: string; @ApiProperty({ description: 'notification message' }) @IsString() - @IsOptional() message: string; } \ No newline at end of file diff --git a/src/modules/notifications/entities/notification.entity.ts b/src/modules/notifications/entities/notification.entity.ts index b99434e..caa251e 100644 --- a/src/modules/notifications/entities/notification.entity.ts +++ b/src/modules/notifications/entities/notification.entity.ts @@ -6,7 +6,8 @@ import { Column, Entity, ManyToOne } from "typeorm"; @Entity('notifications') export class AppNotification extends BaseEntity { @Column({ - type: 'boolean' + type: 'boolean', + default: false }) isRead: boolean; diff --git a/src/modules/notifications/notification.module.ts b/src/modules/notifications/notification.module.ts index 5aa16dc..f11a79e 100644 --- a/src/modules/notifications/notification.module.ts +++ b/src/modules/notifications/notification.module.ts @@ -9,9 +9,12 @@ import { HttpModule } from '@nestjs/axios'; import { NotificationController } from './notification.controller'; import { NotificationService } from './providers/notification.service'; import { NotificationRepository } from './repositories/notification.repository'; +import { TypeOrmModule } from '@nestjs/typeorm'; +import { AppNotification } from './entities/notification.entity'; @Module({ imports: [ + TypeOrmModule.forFeature([AppNotification]), HttpModule, BullModule.registerQueue({ name: SMS_QUEUE, diff --git a/src/modules/notifications/providers/notification.service.ts b/src/modules/notifications/providers/notification.service.ts index 4993329..5f95fd6 100644 --- a/src/modules/notifications/providers/notification.service.ts +++ b/src/modules/notifications/providers/notification.service.ts @@ -6,6 +6,4 @@ export class NotificationService { constructor( private readonly notifRepository: NotificationRepository ) {} - - } \ No newline at end of file