feat: 优化建档草稿和审核详情入口
This commit is contained in:
@@ -2,6 +2,7 @@ import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import {
|
||||
IsArray,
|
||||
IsDateString,
|
||||
IsEnum,
|
||||
IsInt,
|
||||
IsNotEmpty,
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
ValidateNested,
|
||||
} from 'class-validator';
|
||||
import { IsBoolean } from 'class-validator';
|
||||
import { ArtworkStatus, AuditStatus } from '@artveris/shared';
|
||||
import { ArtworkStatus, AuditStatus, CertType, NodeType } from '@artveris/shared';
|
||||
import { PaginationDto } from '../../common/dto/pagination.dto';
|
||||
|
||||
export class MediaItemDto {
|
||||
@@ -61,6 +62,94 @@ export class CreateArtworkDto {
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => MediaItemDto)
|
||||
images?: MediaItemDto[];
|
||||
|
||||
@ApiPropertyOptional({ description: '状态', enum: ArtworkStatus })
|
||||
@IsOptional()
|
||||
@IsEnum(ArtworkStatus)
|
||||
status?: ArtworkStatus;
|
||||
|
||||
@ApiPropertyOptional({ description: '创建时一并保存的溯源时间轴草稿', type: () => [CreateArtworkTraceNodeDto] })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CreateArtworkTraceNodeDto)
|
||||
traceNodes?: CreateArtworkTraceNodeDto[];
|
||||
|
||||
@ApiPropertyOptional({ description: '创建时一并保存的认证文件草稿', type: () => [CreateArtworkCertificateDto] })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => CreateArtworkCertificateDto)
|
||||
certificates?: CreateArtworkCertificateDto[];
|
||||
}
|
||||
|
||||
export class CreateArtworkTraceNodeDto {
|
||||
@ApiProperty({ description: '节点类型', enum: NodeType })
|
||||
@IsEnum(NodeType)
|
||||
nodeType!: NodeType;
|
||||
|
||||
@ApiProperty({ description: '节点标题' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(80)
|
||||
title!: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '发生时间' })
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
occurredAt?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '地点' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(120)
|
||||
location?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '说明' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(2000)
|
||||
description?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '图片/视频', type: [MediaItemDto] })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
@Type(() => MediaItemDto)
|
||||
mediaFiles?: MediaItemDto[];
|
||||
|
||||
@ApiPropertyOptional({ description: '排序' })
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
sortOrder?: number;
|
||||
}
|
||||
|
||||
export class CreateArtworkCertificateDto {
|
||||
@ApiProperty({ description: '证书名称' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
@MaxLength(120)
|
||||
name!: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '颁发机构' })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@MaxLength(120)
|
||||
issuer?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: '颁发时间' })
|
||||
@IsOptional()
|
||||
@IsDateString()
|
||||
issuedAt?: string;
|
||||
|
||||
@ApiProperty({ description: '类型', enum: CertType })
|
||||
@IsEnum(CertType)
|
||||
type!: CertType;
|
||||
|
||||
@ApiProperty({ description: '原始文件存储 key(上传接口返回)' })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
originKey!: string;
|
||||
}
|
||||
|
||||
export class UpdateArtworkDto {
|
||||
|
||||
Reference in New Issue
Block a user