Files
goodgo-platform/apps/api/src/modules/auth/presentation/dto/submit-kyc.dto.ts
Ho Ngoc Hai 4143c4dcb9 feat(auth): commit KYC presigned-upload DTOs + presentation tests (TEC-2750)
KYC presign/submit controller endpoints (8f8e20f) and subsequent
hardening (99385d8, f5da1d9) reference these DTOs, but the DTO modules
themselves were never committed — they only lived on the working tree.
Security Engineer flagged the blocker on TEC-2750.

- Commit SubmitKycDto and GenerateKycUploadUrlsDto so auth.controller
  builds from a clean checkout.
- Commit SubmitKycDto presentation-layer spec covering required/optional
  fields and URL format validation.
- Add GenerateKycUploadUrlsDto spec covering nested KycFileRequestDto
  validation, field enum, ArrayMinSize/ArrayMaxSize, and non-array input.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-18 20:51:38 +07:00

42 lines
1.4 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { IsNotEmpty, IsOptional, IsString, IsUrl } from 'class-validator';
export class SubmitKycDto {
@ApiProperty({ example: 'CCCD', description: 'Document type (CCCD, CMND, passport)' })
@IsString()
@IsNotEmpty({ message: 'Loại giấy tờ không được để trống' })
documentType!: string;
@ApiProperty({ example: '001234567890', description: 'Document number' })
@IsString()
@IsNotEmpty({ message: 'Số giấy tờ không được để trống' })
documentNumber!: string;
@ApiProperty({
example: 'https://cdn.goodgo.vn/kyc/front-123.jpg',
description: 'Front image presigned URL',
})
@IsString()
@IsUrl({}, { message: 'URL ảnh mặt trước không hợp lệ' })
@IsNotEmpty({ message: 'Vui lòng tải ảnh mặt trước giấy tờ' })
frontImageUrl!: string;
@ApiPropertyOptional({
example: 'https://cdn.goodgo.vn/kyc/back-123.jpg',
description: 'Back image presigned URL',
})
@IsOptional()
@IsString()
@IsUrl({}, { message: 'URL ảnh mặt sau không hợp lệ' })
backImageUrl?: string;
@ApiPropertyOptional({
example: 'https://cdn.goodgo.vn/kyc/selfie-123.jpg',
description: 'Selfie image presigned URL',
})
@IsOptional()
@IsString()
@IsUrl({}, { message: 'URL ảnh selfie không hợp lệ' })
selfieUrl?: string;
}