diff --git a/middlewares/validators/account.validator.js b/middlewares/validators/account.validator.js index b20a8221..91ef6e1e 100644 --- a/middlewares/validators/account.validator.js +++ b/middlewares/validators/account.validator.js @@ -6,7 +6,7 @@ module.exports = { newAccountValidator: [ VALIDATOR.stringValidator("body", "firstName", false), VALIDATOR.stringValidator("body", "lastName", false), - VALIDATOR.stringValidator("body", "pronoun", false), + VALIDATOR.alphaArrayValidator("body", "pronoun", false), VALIDATOR.stringValidator("body", "gender", false), VALIDATOR.regexValidator("body", "email", false, Constants.EMAIL_REGEX), VALIDATOR.alphaArrayValidator("body", "dietaryRestrictions", false), @@ -24,7 +24,7 @@ module.exports = { updateAccountValidator: [ VALIDATOR.stringValidator("body", "firstName", true), VALIDATOR.stringValidator("body", "lastName", true), - VALIDATOR.stringValidator("body", "pronoun", true), + VALIDATOR.alphaArrayValidator("body", "pronoun", true), VALIDATOR.stringValidator("body", "gender", true), VALIDATOR.regexValidator("body", "email", true, Constants.EMAIL_REGEX), VALIDATOR.alphaArrayValidator("body", "dietaryRestrictions", true), diff --git a/models/account.model.js b/models/account.model.js index fe83490f..92e718d4 100644 --- a/models/account.model.js +++ b/models/account.model.js @@ -12,10 +12,10 @@ const AccountSchema = new mongoose.Schema({ type: String, required: true }, - pronoun: { + pronoun: [{ type: String, default: "Prefer not to say" - }, + }], gender: { type: String, default: "Prefer not to say" diff --git a/routes/api/account.js b/routes/api/account.js index 9481051b..c637d9bb 100644 --- a/routes/api/account.js +++ b/routes/api/account.js @@ -67,7 +67,7 @@ module.exports = { * * @apiParam (body) {String} firstName First name of the account creator. * @apiParam (body) {String} lastName Last name of the account creator. - * @apiParam (body) {String} pronoun the pronoun of the account creator. + * @apiParam (body) {String[]} pronoun the pronoun of the account creator. * @apiParam (body) {String} email Email of the account. * @apiParam (body) {String} gender Gender of the account creator. * @apiParam (body) {String[]} dietaryRestrictions Any dietary restrictions for the user. 'None' if there are no restrictions @@ -209,7 +209,7 @@ module.exports = { * * @apiParam (body) {String} [firstName] First name of the account creator. * @apiParam (body) {String} [lastName] Last name of the account creator. - * @apiParam (body) {String} [pronoun] The pronoun of the account creator. + * @apiParam (body) {String[]} [pronoun] The pronoun of the account creator. * @apiParam (body) {String} [email] Email of the account. * @apiParam (body) {String} [gender] Gender of the account creator. * @apiParam (body) {String} [age] Age of the account creator. diff --git a/tests/util/account.test.util.js b/tests/util/account.test.util.js index 4e8655f5..12f41d87 100644 --- a/tests/util/account.test.util.js +++ b/tests/util/account.test.util.js @@ -257,7 +257,7 @@ const waitlistedHacker0 = { _id: new mongoose.Types.ObjectId(), firstName: "abcd", lastName: "defg3", - pronoun: "They/Them", + pronoun: ["They/Them"], gender: "Female", email: "waitlisted1@blahblah.com", password: "probsShouldBeHashed2", @@ -274,7 +274,7 @@ const NonConfirmedAccount1 = { _id: new mongoose.Types.ObjectId(), firstName: "LMAO", lastName: "ROFL", - pronoun: "Ey/Em", + pronoun: ["Ey/Em"], gender: "Female", email: "notconfirmed1@blahblah.com", password: "probsShouldBeHashed5", @@ -309,7 +309,7 @@ const NoPhoneHackerAccount0 = { _id: new mongoose.Types.ObjectId(), firstName: "LMAO", lastName: "ROFL", - pronoun: "Ey/Em", + pronoun: ["Ey/Em"], gender: "Female", email: "noPhone0@blahblah.com", password: "probsShouldBeHashed5",