Updated dependencies; added translation string to CreateTeamSchema schema
This commit is contained in:
@@ -4,26 +4,36 @@ import { z } from 'zod';
|
||||
* @name RESERVED_NAMES_ARRAY
|
||||
* @description Array of reserved names for team accounts
|
||||
* This is a list of names that cannot be used for team accounts as they are reserved for other purposes.
|
||||
* Please include any new reserved names here.
|
||||
*/
|
||||
const RESERVED_NAMES_ARRAY = [
|
||||
'settings',
|
||||
'billing',
|
||||
// please add more reserved names here
|
||||
'settings',
|
||||
'billing',
|
||||
// please add more reserved names here
|
||||
];
|
||||
|
||||
const ReservedTeamNameSchema = z
|
||||
.string()
|
||||
.min(3)
|
||||
/**
|
||||
* @name TeamNameSchema
|
||||
*/
|
||||
const TeamNameSchema = z
|
||||
.string({
|
||||
description: 'The name of the team account',
|
||||
})
|
||||
.min(2)
|
||||
.max(50)
|
||||
.refine(
|
||||
(name) => {
|
||||
return !RESERVED_NAMES_ARRAY.includes(name);
|
||||
},
|
||||
{
|
||||
message: 'This name is reserved and cannot be used for a team account',
|
||||
message: 'teams:reservedNameError',
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
* @name CreateTeamSchema
|
||||
* @description Schema for creating a team account
|
||||
*/
|
||||
export const CreateTeamSchema = z.object({
|
||||
name: ReservedTeamNameSchema,
|
||||
name: TeamNameSchema,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user