diff --git a/src/modules/phone/dto/send-code.dto.ts b/src/modules/phone/dto/send-code.dto.ts new file mode 100644 index 0000000..d06f843 --- /dev/null +++ b/src/modules/phone/dto/send-code.dto.ts @@ -0,0 +1,10 @@ +import { IsNotEmpty, IsString, Matches } from 'class-validator'; + +export class SendCodeDto { + @IsNotEmpty() + @IsString() + @Matches(/^010-\d{4}-\d{4}$/, { + message: '휴대전화 번호는 반드시 형식에 맞게 작성해야합니다.', + }) + phoneNumber: string; +} \ No newline at end of file diff --git a/src/modules/phone/dto/verify-code.dto.ts b/src/modules/phone/dto/verify-code.dto.ts new file mode 100644 index 0000000..1dc470a --- /dev/null +++ b/src/modules/phone/dto/verify-code.dto.ts @@ -0,0 +1,17 @@ +import { IsNotEmpty, IsString, Length, Matches } from 'class-validator'; + +export class VerifyCodeDto { + @IsNotEmpty() + @IsString() + @Matches(/^010-\d{4}-\d{4}$/, { + message: '휴대전화 번호는 반드시 형식에 맞게 작성해야합니다.', + }) + phoneNumber: string; + + @IsNotEmpty() + @IsString() + @Length(6, 6, { + message: '코드는 여섯자리입니다.' + }) + code: string; +} \ No newline at end of file