forked from Yara724/api
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
|
import { IsIn, IsNotEmpty, IsOptional, IsString } from "class-validator";
|
|
|
|
/**
|
|
* One-at-a-time OTP send for the expert-initiated IN_PERSON flow.
|
|
* The expert sends an OTP to a single party's phone, collects the code, then
|
|
* verifies. Repeat for the second party (no invite link is used).
|
|
*/
|
|
export class SendPartyOtpDto {
|
|
@ApiProperty({
|
|
description: "Phone number of the party to send the OTP to.",
|
|
example: "09123456789",
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
phoneNumber: string;
|
|
}
|
|
|
|
export class VerifyPartyOtpDto {
|
|
@ApiProperty({
|
|
description: "Phone number the OTP was sent to.",
|
|
example: "09123456789",
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
phoneNumber: string;
|
|
|
|
@ApiProperty({
|
|
description: "OTP code collected from the party.",
|
|
example: "123456",
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
otp: string;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
"Which party this phone belongs to. Optional: when omitted, FIRST is bound if it has no user yet, otherwise SECOND (created if missing).",
|
|
enum: ["FIRST", "SECOND"],
|
|
example: "FIRST",
|
|
})
|
|
@IsOptional()
|
|
@IsIn(["FIRST", "SECOND"])
|
|
partyRole?: "FIRST" | "SECOND";
|
|
}
|