feat(v2.7): 接入协作治理前端体验

This commit is contained in:
2026-07-08 16:31:06 +08:00
parent bcbe84bb6e
commit 9ba9449c1a
23 changed files with 987 additions and 2 deletions

View File

@@ -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>;
}

View File

@@ -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);