From b8c1e06e65a23919f842d35f4a2aceedb769402e Mon Sep 17 00:00:00 2001 From: realrafi Date: Sat, 1 Aug 2026 00:09:17 +0330 Subject: [PATCH] feat: added create and update dto for notification --- .../DTO/create-notification.dto.ts | 39 +++++++++++++++++++ .../DTO/update-notification.dto.ts | 4 ++ .../notifications/notification.module.ts | 2 + .../providers/notification.service.ts | 9 ++++- 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 src/modules/notifications/DTO/create-notification.dto.ts create mode 100644 src/modules/notifications/DTO/update-notification.dto.ts diff --git a/src/modules/notifications/DTO/create-notification.dto.ts b/src/modules/notifications/DTO/create-notification.dto.ts new file mode 100644 index 0000000..802148d --- /dev/null +++ b/src/modules/notifications/DTO/create-notification.dto.ts @@ -0,0 +1,39 @@ +import { ApiProperty } from "@nestjs/swagger"; +import { IsBoolean, IsNotEmpty, IsOptional, IsString, IsUUID } from "class-validator"; + +export class CreateNotificationDto { + @ApiProperty({ + description: 'Id of the receiver user' + }) + @IsUUID() + @IsNotEmpty() + userId: string; + + @ApiProperty({ + description: 'Id of the sender organization' + }) + @IsUUID() + @IsNotEmpty() + organId: string; + + @ApiProperty({ + description: 'whether the notif is read or not' + }) + @IsBoolean() + @IsOptional() + isRead: boolean; + + @ApiProperty({ + 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/DTO/update-notification.dto.ts b/src/modules/notifications/DTO/update-notification.dto.ts new file mode 100644 index 0000000..c24955e --- /dev/null +++ b/src/modules/notifications/DTO/update-notification.dto.ts @@ -0,0 +1,4 @@ +import { PartialType } from "@nestjs/swagger"; +import { CreateNotificationDto } from "./create-notification.dto"; + +export class UpdateNotificationDto extends PartialType(CreateNotificationDto) {} \ No newline at end of file diff --git a/src/modules/notifications/notification.module.ts b/src/modules/notifications/notification.module.ts index a08230e..5aa16dc 100644 --- a/src/modules/notifications/notification.module.ts +++ b/src/modules/notifications/notification.module.ts @@ -8,6 +8,7 @@ import { smsConfigsProvider } from 'src/config/sms.config'; import { HttpModule } from '@nestjs/axios'; import { NotificationController } from './notification.controller'; import { NotificationService } from './providers/notification.service'; +import { NotificationRepository } from './repositories/notification.repository'; @Module({ imports: [ @@ -23,6 +24,7 @@ import { NotificationService } from './providers/notification.service'; SmsProducer, SmsProcessor, NotificationService, + NotificationRepository ], exports: [SmsProducer, SMS_CONFIG, NotificationService], }) diff --git a/src/modules/notifications/providers/notification.service.ts b/src/modules/notifications/providers/notification.service.ts index 9418d47..4993329 100644 --- a/src/modules/notifications/providers/notification.service.ts +++ b/src/modules/notifications/providers/notification.service.ts @@ -1,4 +1,11 @@ import { Injectable } from "@nestjs/common"; +import { NotificationRepository } from "../repositories/notification.repository"; @Injectable() -export class NotificationService {} \ No newline at end of file +export class NotificationService { + constructor( + private readonly notifRepository: NotificationRepository + ) {} + + +} \ No newline at end of file