diff --git a/src/controllers/organization/memberships.ts b/src/controllers/organization/memberships.ts index 115b1a2cc..9deb52269 100644 --- a/src/controllers/organization/memberships.ts +++ b/src/controllers/organization/memberships.ts @@ -56,8 +56,12 @@ export class OrganizationMembershipsController { joiValidate( { organizationId: Joi.string().required(), - newMemberName: Joi.string().min(6).required(), - newMemberEmail: Joi.string().email().required(), + newMemberName: Joi.string() + .min(6) + .required(), + newMemberEmail: Joi.string() + .email() + .required(), role: Joi.number(), }, { @@ -100,7 +104,7 @@ export class OrganizationMembershipsController { @Middleware( validator( { - role: Joi.number().min(1).max(5), + role: Joi.string().allow(["OWNER", "ADMIN", "RESELLER", "MEMBER"]), }, "body" ) diff --git a/src/controllers/user/index.ts b/src/controllers/user/index.ts index 37f555c52..778a27cd9 100644 --- a/src/controllers/user/index.ts +++ b/src/controllers/user/index.ts @@ -55,14 +55,22 @@ export class UserController { primaryEmail: Joi.string(), countryCode: Joi.string().length(2), password: Joi.string().min(6), - gender: Joi.string().length(1), + gender: Joi.string().allow(["MALE", "FEMALE", "NONBINARY", "UNKNOWN"]), preferredLanguage: Joi.string() .min(2) .max(5), timezone: Joi.string(), - notificationEmails: Joi.number(), - prefersReducedMotion: Joi.boolean(), - prefersColorSchemeDark: Joi.boolean(), + notificationEmails: Joi.string().allow([ + "ACCOUNT", + "UPDATES", + "PROMOTIONS", + ]), + prefersReducedMotion: Joi.string().allow(["NO_PREFERENCE", "REDUCE"]), + prefersColorScheme: Joi.string().allow([ + "NO_PREFERENCE", + "LIGHT", + "DARK", + ]), profilePicture: Joi.string(), checkLocationOnLogin: Joi.boolean(), },