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
|
||||
*/
|
||||
const TeamNameSchema = z
|
||||
export const TeamNameSchema = z
|
||||
.string({
|
||||
description: 'The name of the team account',
|
||||
})
|
||||
@@ -23,7 +23,7 @@ const TeamNameSchema = z
|
||||
.max(50)
|
||||
.refine(
|
||||
(name) => {
|
||||
return !RESERVED_NAMES_ARRAY.includes(name);
|
||||
return !RESERVED_NAMES_ARRAY.includes(name.toLowerCase());
|
||||
},
|
||||
{
|
||||
message: 'teams:reservedNameError',
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
import { TeamNameSchema } from './create-team.schema';
|
||||
|
||||
export const TeamNameFormSchema = z.object({
|
||||
name: z.string().min(1).max(255),
|
||||
name: TeamNameSchema,
|
||||
});
|
||||
|
||||
export const UpdateTeamNameSchema = TeamNameFormSchema.merge(
|
||||
|
||||
Reference in New Issue
Block a user