feat: add onboarding and user invitations
This commit is contained in:
parent
24351eb897
commit
762cfe2b16
37 changed files with 5208 additions and 384 deletions
|
|
@ -10,7 +10,12 @@ export const ipv4Schema = z
|
|||
"Must be a valid IPv4 address",
|
||||
);
|
||||
|
||||
export const optionalTextSchema = z.string().trim().max(5000).nullable().optional();
|
||||
export const optionalTextSchema = z
|
||||
.string()
|
||||
.trim()
|
||||
.max(5000)
|
||||
.nullable()
|
||||
.optional();
|
||||
|
||||
export const hostnameSchema = z
|
||||
.string()
|
||||
|
|
@ -23,10 +28,27 @@ export const hostnameSchema = z
|
|||
);
|
||||
|
||||
export const serverStatusSchema = z.enum(["active", "maintenance", "inactive"]);
|
||||
export const serviceTypeSchema = z.enum(["web_app", "mail", "database", "api", "proxy", "other"]);
|
||||
export const serviceProtocolSchema = z.enum(["http", "https", "tcp", "udp", "other"]);
|
||||
export const serviceTypeSchema = z.enum([
|
||||
"web_app",
|
||||
"mail",
|
||||
"database",
|
||||
"api",
|
||||
"proxy",
|
||||
"other",
|
||||
]);
|
||||
export const serviceProtocolSchema = z.enum([
|
||||
"http",
|
||||
"https",
|
||||
"tcp",
|
||||
"udp",
|
||||
"other",
|
||||
]);
|
||||
export const serviceStatusSchema = z.enum(["active", "down", "maintenance"]);
|
||||
export const domainCheckStatusSchema = z.enum(["MATCH", "MISMATCH", "UNRESOLVED"]);
|
||||
export const domainCheckStatusSchema = z.enum([
|
||||
"MATCH",
|
||||
"MISMATCH",
|
||||
"UNRESOLVED",
|
||||
]);
|
||||
|
||||
export const byIdSchema = z.object({
|
||||
id: entityIdSchema,
|
||||
|
|
@ -114,6 +136,47 @@ export const updateUserRolesSchema = z.object({
|
|||
export const userCreateSchema = z.object({
|
||||
name: z.string().trim().min(2, "Name must be at least 2 characters").max(120),
|
||||
email: z.email("Invalid email address").max(255),
|
||||
password: z.string().min(8, "Password must be at least 8 characters").max(255),
|
||||
password: z
|
||||
.string()
|
||||
.min(8, "Password must be at least 8 characters")
|
||||
.max(255),
|
||||
roleIds: z.array(entityIdSchema).min(1, "Select at least one role"),
|
||||
});
|
||||
|
||||
export const onboardingCreateAdminSchema = z.object({
|
||||
name: z.string().trim().min(2, "Name must be at least 2 characters").max(120),
|
||||
email: z.email("Invalid email address").max(255),
|
||||
password: z
|
||||
.string()
|
||||
.min(8, "Password must be at least 8 characters")
|
||||
.max(255),
|
||||
});
|
||||
|
||||
export const userInvitationCreateSchema = z.object({
|
||||
roleIds: z.array(entityIdSchema).min(1, "Select at least one role"),
|
||||
});
|
||||
|
||||
export const invitationTokenSchema = z.object({
|
||||
token: z
|
||||
.string()
|
||||
.min(32, "Invalid invitation link")
|
||||
.max(128, "Invalid invitation link")
|
||||
.regex(/^[A-Za-z0-9_-]+$/, "Invalid invitation link"),
|
||||
});
|
||||
|
||||
export const userInvitationAcceptSchema = invitationTokenSchema.extend({
|
||||
name: z.string().trim().min(2, "Name must be at least 2 characters").max(120),
|
||||
email: z.email("Invalid email address").max(255),
|
||||
password: z
|
||||
.string()
|
||||
.min(8, "Password must be at least 8 characters")
|
||||
.max(255),
|
||||
});
|
||||
|
||||
export const changeInitialPasswordSchema = z.object({
|
||||
currentPassword: z.string().min(1, "Enter your current password").max(255),
|
||||
newPassword: z
|
||||
.string()
|
||||
.min(8, "Password must be at least 8 characters")
|
||||
.max(255),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue