Skip to content

Commit 6c81f53

Browse files
authored
Validate room name length (#1291)
* Update ValidationSchema.ts * Update DetailsValidationSchema.ts
1 parent 821be02 commit 6c81f53

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/pages/Admin/Details/ValidationSchema.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const validationSchema_v2 = Yup.object()
7474
name: Yup.string()
7575
.required("Name is required!")
7676
.min(3, ({ min }) => `Name must be at least ${min} characters`)
77+
.max(20, ({ max }) => `Name must be less than ${max} characters`)
7778
.when(
7879
"$editing",
7980
(editing: boolean, schema: Yup.StringSchema) =>
@@ -136,7 +137,8 @@ export const roomCreateSchema = Yup.object().shape<RoomSchemaShape>({
136137
is: false,
137138
then: Yup.string()
138139
.required("Venue name is required")
139-
.min(3, ({ min }) => `Name must be at least ${min} characters`),
140+
.min(3, ({ min }) => `Name must be at least ${min} characters`)
141+
.max(20, ({ max }) => `Name must be less than ${max} characters`),
140142
})
141143
.when("useUrl", (useUrl: boolean, schema: Yup.StringSchema) =>
142144
!useUrl

src/pages/Admin/Venue/DetailsValidationSchema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const validationSchema = Yup.object()
5959
name: Yup.string()
6060
.required("Required")
6161
.min(1, "Required")
62+
.max(20, ({ max }) => `Name must be less than ${max} characters`)
6263
.when(
6364
"$editing",
6465
(editing: boolean, schema: Yup.StringSchema) =>

0 commit comments

Comments
 (0)