Updated dependencies; added translation string to CreateTeamSchema schema

This commit is contained in:
gbuomprisco
2024-09-13 11:03:31 +02:00
parent 4be76ac797
commit 5706a3486c
18 changed files with 244 additions and 233 deletions

View File

@@ -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,
});