mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-08 17:08:18 +00:00
79 lines
2.4 KiB
TypeScript
79 lines
2.4 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { IsIn, IsOptional, IsString } from 'class-validator';
|
|
|
|
export class StartVerificationDto {
|
|
@ApiPropertyOptional({
|
|
enum: ['LOGIN', 'VERIFY'],
|
|
default: 'VERIFY',
|
|
description:
|
|
'Reason for verification. VERIFY returns the verified identity attributes; LOGIN resolves/creates a user and returns a JWT.',
|
|
})
|
|
@IsOptional()
|
|
@IsIn(['LOGIN', 'VERIFY'])
|
|
purpose?: 'LOGIN' | 'VERIFY';
|
|
|
|
@ApiPropertyOptional({
|
|
enum: ['WEB', 'MOBILE'],
|
|
default: 'WEB',
|
|
description:
|
|
'Client platform. Decides where /callback redirects on completion: a web https URL (WEB) or a custom-scheme deep link the Flutter app intercepts (MOBILE).',
|
|
})
|
|
@IsOptional()
|
|
@IsIn(['WEB', 'MOBILE'])
|
|
platform?: 'WEB' | 'MOBILE';
|
|
}
|
|
|
|
export class CompleteVerificationResultDto {
|
|
@ApiProperty({ enum: ['LOGIN', 'VERIFY'] })
|
|
purpose: 'LOGIN' | 'VERIFY';
|
|
|
|
@ApiProperty() verified: boolean;
|
|
|
|
@ApiPropertyOptional({ description: 'JWT (LOGIN flow only).' })
|
|
token?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Authenticated user summary (LOGIN flow only; same shape as /auth/login).',
|
|
})
|
|
user?: {
|
|
id: string;
|
|
email: string;
|
|
role: string;
|
|
passengerId?: string;
|
|
agentId?: string;
|
|
};
|
|
|
|
@ApiPropertyOptional({ description: 'Verified full name from Fayda (VERIFY flow).' })
|
|
fullName?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Verified email from Fayda (VERIFY flow).' })
|
|
email?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Verified phone number from Fayda (VERIFY flow).' })
|
|
phoneNumber?: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description: 'Verified date of birth from Fayda, ISO yyyy-MM-dd (VERIFY flow).',
|
|
})
|
|
birthdate?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Verified gender from Fayda (VERIFY flow).' })
|
|
gender?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Whether the verified identity was saved to IAM. False if the IAM write failed.' })
|
|
userDataSaved?: boolean;
|
|
}
|
|
|
|
export class VerifaydaCallbackDto {
|
|
@ApiPropertyOptional() @IsOptional() @IsString() code?: string;
|
|
@ApiPropertyOptional() @IsOptional() @IsString() state?: string;
|
|
@ApiPropertyOptional() @IsOptional() @IsString() error?: string;
|
|
@ApiPropertyOptional() @IsOptional() @IsString() error_description?: string;
|
|
}
|
|
|
|
export class VerificationStatusDto {
|
|
@ApiProperty() verified: boolean;
|
|
@ApiPropertyOptional() verifiedAt?: Date;
|
|
@ApiPropertyOptional() fullName?: string;
|
|
}
|