forked from Shared/esg
Added car by motor
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { IsNotEmpty, IsString, Length, Matches } from 'class-validator';
|
||||
|
||||
export class CarByMotorRequestDto {
|
||||
@ApiProperty({ example: '4311402422', description: 'Owner national code (10 digits)' })
|
||||
@IsString()
|
||||
@Length(10, 10)
|
||||
@Matches(/^\d{10}$/, { message: 'nationalCode must be exactly 10 digits' })
|
||||
nationalCode!: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: '147H0403219',
|
||||
description: 'Vehicle motor/engine number',
|
||||
})
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
motorNo!: string;
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import { PolicyByNationalCodeRequestDto } from './dto/policy-by-national-code-re
|
||||
import { PolicyByPlateRequestDto } from './dto/policy-by-plate-request.dto';
|
||||
import { CarByPlateRequestDto } from './dto/car-by-plate-request.dto';
|
||||
import { CarByChassisRequestDto } from './dto/car-by-chassis-request.dto';
|
||||
import { CarByMotorRequestDto } from './dto/car-by-motor-request.dto';
|
||||
import { InquiryService } from './inquiry.service';
|
||||
|
||||
/**
|
||||
@@ -176,6 +177,22 @@ export class InquiryController {
|
||||
);
|
||||
}
|
||||
|
||||
@Post('carByMotor')
|
||||
@InquiryAccess(InquiryType.CAR_BY_MOTOR)
|
||||
@Throttle({ default: { limit: 30, ttl: 60000 } })
|
||||
@ApiOperation({ summary: 'Car insurance inquiry by motor/engine number (provider passthrough)' })
|
||||
@ApiResponse({ status: 200, type: GenericInquiryResponseDto })
|
||||
async inquireCarByMotor(
|
||||
@Body() payload: CarByMotorRequestDto,
|
||||
@Req() req: Request & { requestId?: string; trackingCode?: string },
|
||||
): Promise<BaseInquiryResponseDto<Record<string, unknown>>> {
|
||||
return this.inquireGeneric(
|
||||
InquiryType.CAR_BY_MOTOR,
|
||||
payload as unknown as Record<string, unknown>,
|
||||
req,
|
||||
);
|
||||
}
|
||||
|
||||
@Post('thirdPartyCar')
|
||||
@InquiryAccess(InquiryType.THIRD_PARTY_CAR)
|
||||
@Throttle({ default: { limit: 30, ttl: 60000 } })
|
||||
|
||||
Reference in New Issue
Block a user