feat: 实现模板、艺术品建档、溯源节点与证书水印
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
IsArray,
|
||||
IsEnum,
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
IsObject,
|
||||
IsOptional,
|
||||
IsString,
|
||||
MaxLength,
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { ArtworkStatus } from '@artveris/shared';
|
||||
import { PaginationDto } from '../../common/dto/pagination.dto';
|
||||
|
||||
export class MediaItemDto {
|
||||
@ApiProperty({ description: '存储 key(上传接口返回)' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
key!: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '原始文件名' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
name?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '类型:image | video' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
type?: string;
|
||||
}
|
||||
|
||||
export class CreateArtworkDto {
|
||||
@ApiProperty({ description: '模板 ID' })
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
templateId!: number;
|
||||
|
||||
@ApiProperty({ description: '作品名称' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(120)
|
||||
title!: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '艺术家 / 创作者' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(120)
|
||||
artist?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '动态字段数据(按模板字段键存储)' })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
dynamicFields?: Record<string, unknown>;
|
||||
|
||||
@ApiPropertyOptional({ description: '作品图片', type: [MediaItemDto] })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => MediaItemDto)
|
||||
images?: MediaItemDto[];
|
||||
}
|
||||
|
||||
export class UpdateArtworkDto {
|
||||
@ApiPropertyOptional({ description: '作品名称' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(120)
|
||||
title?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '艺术家 / 创作者' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(120)
|
||||
artist?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '动态字段数据' })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
dynamicFields?: Record<string, unknown>;
|
||||
|
||||
@ApiPropertyOptional({ description: '作品图片', type: [MediaItemDto] })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => MediaItemDto)
|
||||
images?: MediaItemDto[];
|
||||
|
||||
@ApiPropertyOptional({ description: '状态', enum: ArtworkStatus })
|
||||
@IsOptional()
|
||||
@IsEnum(ArtworkStatus)
|
||||
status?: ArtworkStatus;
|
||||
}
|
||||
|
||||
export class QueryArtworkDto extends PaginationDto {
|
||||
@ApiPropertyOptional({ description: '关键词(名称/艺术家)' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
keyword?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '状态', enum: ArtworkStatus })
|
||||
@IsOptional()
|
||||
@IsEnum(ArtworkStatus)
|
||||
status?: ArtworkStatus;
|
||||
|
||||
@ApiPropertyOptional({ description: '模板 ID' })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsInt()
|
||||
templateId?: number;
|
||||
}
|
||||
Reference in New Issue
Block a user