feat(v2.7): 接入协作治理前端体验
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { IsIn, IsObject, IsOptional, IsString } from 'class-validator';
|
||||
import { NOTIFICATION_TYPES, type NotificationType } from '../notification.service';
|
||||
|
||||
export class CreateNotificationDto {
|
||||
@IsString()
|
||||
recipientId!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
actorId?: string;
|
||||
|
||||
@IsIn(NOTIFICATION_TYPES)
|
||||
type!: NotificationType;
|
||||
|
||||
@IsString()
|
||||
title!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
body?: string;
|
||||
|
||||
@IsString()
|
||||
resourceType!: string;
|
||||
|
||||
@IsString()
|
||||
resourceId!: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
resourceVersionId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
productId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
projectId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
versionId?: string;
|
||||
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
metadata?: Record<string, unknown>;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Body, Controller, Get, Param, Patch, Query } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Param, Patch, Post, Query } from '@nestjs/common';
|
||||
import { CreateNotificationDto } from './dto/create-notification.dto';
|
||||
import { MarkNotificationReadDto } from './dto/mark-notification-read.dto';
|
||||
import { NotificationService } from './notification.service';
|
||||
|
||||
@@ -19,6 +20,11 @@ export class NotificationController {
|
||||
});
|
||||
}
|
||||
|
||||
@Post()
|
||||
create(@Body() dto: CreateNotificationDto) {
|
||||
return this.notificationService.create(dto);
|
||||
}
|
||||
|
||||
@Patch(':id/read')
|
||||
markRead(@Param('id') id: string, @Body() dto: MarkNotificationReadDto) {
|
||||
return this.notificationService.markRead(id, dto.recipientId);
|
||||
|
||||
Reference in New Issue
Block a user