Created a list of reserved names that the user cannot choose to create a team account

This commit is contained in:
gbuomprisco
2024-09-13 10:52:59 +02:00
parent 2649ac3a4e
commit 4be76ac797

View File

@@ -1,5 +1,29 @@
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.
*/
const RESERVED_NAMES_ARRAY = [
'settings',
'billing',
// please add more reserved names here
];
const ReservedTeamNameSchema = z
.string()
.min(3)
.max(50)
.refine(
(name) => {
return !RESERVED_NAMES_ARRAY.includes(name);
},
{
message: 'This name is reserved and cannot be used for a team account',
},
);
export const CreateTeamSchema = z.object({
name: z.string().min(2).max(50),
name: ReservedTeamNameSchema,
});