-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #381 from TripInfoWeb/dev_auth
feat: 유저 추가정보 유효성 검증 추가
- Loading branch information
Showing
2 changed files
with
76 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { z } from "zod"; | ||
|
||
const currentYear = new Date().getFullYear(); | ||
|
||
// 유저 추가정보 받을 떄 유효성 검사 | ||
export const AddUserInformationFormSchema = z.object({ | ||
name: z | ||
.string() | ||
.min(1, { message: "이름은 1글자 이상이어야 합니다." }) | ||
.max(10, { message: "이름은 10글자 이하이어야 합니다." }), | ||
|
||
age: z | ||
.number() | ||
.min(currentYear - 58, { | ||
message: "나이는 59세까지 허용이 됩니다..", | ||
}) | ||
.max(currentYear - 19, { message: "나이는 20살 이상이어야 합니다." }), | ||
|
||
sex: z.string().min(1, { message: "성별은 선택은 필수입니다." }), | ||
}); |