Improved TeamNameFormSchema to be case insensitive (#102)
This commit is contained in:
committed by
GitHub
parent
9bdab95909
commit
b8e1bf3c18
@@ -15,7 +15,7 @@ const RESERVED_NAMES_ARRAY = [
|
|||||||
/**
|
/**
|
||||||
* @name TeamNameSchema
|
* @name TeamNameSchema
|
||||||
*/
|
*/
|
||||||
const TeamNameSchema = z
|
export const TeamNameSchema = z
|
||||||
.string({
|
.string({
|
||||||
description: 'The name of the team account',
|
description: 'The name of the team account',
|
||||||
})
|
})
|
||||||
@@ -23,7 +23,7 @@ const TeamNameSchema = z
|
|||||||
.max(50)
|
.max(50)
|
||||||
.refine(
|
.refine(
|
||||||
(name) => {
|
(name) => {
|
||||||
return !RESERVED_NAMES_ARRAY.includes(name);
|
return !RESERVED_NAMES_ARRAY.includes(name.toLowerCase());
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
message: 'teams:reservedNameError',
|
message: 'teams:reservedNameError',
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
import { TeamNameSchema } from './create-team.schema';
|
||||||
|
|
||||||
export const TeamNameFormSchema = z.object({
|
export const TeamNameFormSchema = z.object({
|
||||||
name: z.string().min(1).max(255),
|
name: TeamNameSchema,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const UpdateTeamNameSchema = TeamNameFormSchema.merge(
|
export const UpdateTeamNameSchema = TeamNameFormSchema.merge(
|
||||||
|
|||||||
Reference in New Issue
Block a user