forked from datawhale/whale-town-end
feat:实现通知系统核心功能
- 添加通知实体和数据传输对象 - 实现通知服务层逻辑,支持创建、查询、标记已读 - 添加通知REST API控制器 - 实现WebSocket网关,支持实时通知推送 - 支持系统通知、用户通知、广播通知三种类型 - 支持定时通知功能,每分钟自动检查待发送通知 - 添加通知模块导出
This commit is contained in:
38
src/business/notice/dto/create-notice.dto.ts
Normal file
38
src/business/notice/dto/create-notice.dto.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { IsString, IsOptional, IsNumber, IsEnum, IsDateString, IsObject } from 'class-validator';
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { NoticeType } from '../notice.entity';
|
||||
|
||||
export class CreateNoticeDto {
|
||||
@ApiProperty({ description: '通知标题' })
|
||||
@IsString()
|
||||
title: string;
|
||||
|
||||
@ApiProperty({ description: '通知内容' })
|
||||
@IsString()
|
||||
content: string;
|
||||
|
||||
@ApiPropertyOptional({ enum: NoticeType, description: '通知类型' })
|
||||
@IsOptional()
|
||||
@IsEnum(NoticeType)
|
||||
type?: NoticeType;
|
||||
|
||||
@ApiPropertyOptional({ description: '接收者用户ID,不填表示广播' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
userId?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: '发送者用户ID' })
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
senderId?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: '计划发送时间' })
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
scheduledAt?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '额外元数据' })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
metadata?: Record<string, any>;
|
||||
}
|
||||
Reference in New Issue
Block a user