Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🐛 Fix validations with new schema
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Apr 20, 2020
1 parent 5d43321 commit b0f44cb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
10 changes: 7 additions & 3 deletions src/controllers/organization/memberships.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
{
Expand Down Expand Up @@ -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"
)
Expand Down
16 changes: 12 additions & 4 deletions src/controllers/user/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
Expand Down

0 comments on commit b0f44cb

Please sign in to comment.