initial commit

This commit is contained in:
2026-06-09 14:07:37 +03:30
parent 30ac533800
commit 996a4fcda7
121 changed files with 20557 additions and 3 deletions
@@ -0,0 +1,29 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { NormalizedErrorDto } from './normalized-error.dto';
/**
* Unified inquiry response envelope.
* Every inquiry endpoint MUST return this structure.
*/
export class BaseInquiryResponseDto<T = Record<string, unknown>> {
@ApiProperty({ example: true })
success!: boolean;
@ApiProperty({ example: 'HAMTA' })
provider!: string;
@ApiProperty({ example: 'INQ-20250525-ABC123' })
trackingCode!: string;
@ApiPropertyOptional({ example: 'Inquiry completed successfully' })
message?: string;
@ApiPropertyOptional()
data?: T;
@ApiPropertyOptional({ type: NormalizedErrorDto })
error?: NormalizedErrorDto;
@ApiProperty({ example: 342, description: 'Duration in milliseconds' })
duration!: number;
}
+19
View File
@@ -0,0 +1,19 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
/**
* Standardized error shape returned to API consumers
* regardless of upstream provider error formats.
*/
export class NormalizedErrorDto {
@ApiProperty({ example: 'PROVIDER_TIMEOUT' })
code!: string;
@ApiProperty({ example: 'Provider request timed out' })
message!: string;
@ApiPropertyOptional({ example: 'سرویس در دسترس نیست' })
providerMessage?: string;
@ApiPropertyOptional({ example: '503' })
providerCode?: string;
}