documents/src/modules/document/dto/response/documentResponse.dto.ts
Breno Pires 9165f1e9ab feat: microservico documents — catalogo por UF, documentos com versoes, compliance e analise [skip ci]
Espelho do routines: NestJS 10 + Fastify + TypeORM, modulos catalog (override
por UF), document (versoes + storage GCS), compliance (mesmo score do painel),
alerts (regua de vencimento, envio e v1.2) e analise plugavel (KeywordAnalyzer
-> OCR/LLM). 38 testes. Deploy aguarda banco 'documents' e secrets no hml2 —
por isso o [skip ci] no bootstrap.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-07 01:42:24 -03:00

109 lines
2.4 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { StoreDocumentStatus } from '../../../common/enum/document.enum';
/** Contrato com o painel: IExternalDocumentVersion. */
export class DocumentVersionResponseDto {
@ApiProperty()
id: string;
@ApiProperty()
fileName: string;
@ApiProperty()
fileSize: number;
@ApiProperty()
issueDate: string;
@ApiProperty({ nullable: true, type: 'string' })
expiryDate: string | null;
@ApiPropertyOptional({ nullable: true, type: 'string' })
documentNumber?: string | null;
@ApiProperty()
uploadedAt: string;
@ApiPropertyOptional({ nullable: true, type: 'string' })
uploadedBy?: string | null;
@ApiPropertyOptional({
description: 'URL assinada de vida curta — nunca persistir',
nullable: true,
type: 'string',
})
fileUrl?: string | null;
}
export class RenewalProtocolDto {
@ApiProperty()
protocolNumber: string;
@ApiProperty()
protocolDate: string;
}
/** Contrato com o painel: IExternalStoreDocument. */
export class StoreDocumentResponseDto {
@ApiProperty()
id: string;
@ApiProperty()
typeCode: string;
@ApiProperty()
storeId: string;
@ApiProperty({ enum: StoreDocumentStatus })
status: StoreDocumentStatus;
@ApiProperty({ nullable: true, type: 'string' })
issueDate: string | null;
@ApiProperty({ nullable: true, type: 'string' })
expiryDate: string | null;
@ApiPropertyOptional({ nullable: true, type: 'string' })
documentNumber?: string | null;
@ApiPropertyOptional({ nullable: true, type: 'string' })
responsible?: string | null;
@ApiPropertyOptional({ nullable: true, type: 'string' })
notes?: string | null;
@ApiPropertyOptional({ nullable: true, type: RenewalProtocolDto })
renewalProtocol?: RenewalProtocolDto | null;
@ApiProperty({ type: [DocumentVersionResponseDto] })
versions: DocumentVersionResponseDto[];
}
export class StoreDocumentListResponseDto {
@ApiProperty({ type: [StoreDocumentResponseDto] })
data: StoreDocumentResponseDto[];
@ApiProperty()
count: number;
}
/** Contrato com o painel: IExternalAnalysisResult. */
export class AnalysisResultResponseDto {
@ApiProperty({ nullable: true, type: 'string' })
suggestedTypeCode: string | null;
@ApiProperty()
confidence: number;
@ApiProperty()
detectedFields: {
issueDate?: string | null;
expiryDate?: string | null;
documentNumber?: string | null;
};
@ApiProperty({ type: [String] })
warnings: string[];
}