Skip to content

Commit dbc0e07

Browse files
authored
Merge pull request #133 from Real-Dev-Squad/ref/user
Ref(middleware/user): Few extra form fields added
2 parents 57d7432 + 79732a4 commit dbc0e07

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

.eslintrc.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,8 @@ module.exports = {
88
node: true,
99
mocha: true
1010
},
11-
extends: [
12-
'standard',
13-
'plugin:mocha/recommended',
14-
'plugin:security/recommended'
15-
],
16-
plugins: [
17-
'mocha',
18-
'security'
19-
],
11+
extends: ['standard', 'plugin:mocha/recommended', 'plugin:security/recommended'],
12+
plugins: ['mocha', 'security'],
2013
parserOptions: {
2114
ecmaVersion: 12
2215
},

middlewares/validators/user.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ const joi = require('joi')
22

33
const createUser = async (req, res, next) => {
44
const schema = joi.object().keys({
5+
phone: joi.string().optional(),
6+
email: joi.string().optional(),
7+
company_name: joi.string().optional(),
58
username: joi.string().optional(),
6-
first_name: joi.string().required(),
7-
last_name: joi.string().required(),
9+
first_name: joi.string().optional(),
10+
last_name: joi.string().optional(),
811
yoe: joi.number().optional(),
912
company: joi.string().optional(),
1013
designation: joi.string().optional(),
@@ -16,7 +19,8 @@ const createUser = async (req, res, next) => {
1619
instagram_id: joi.string().optional(),
1720
site: joi.string().optional(),
1821
isMember: joi.boolean().optional(),
19-
tokens: joi.object().optional()
22+
tokens: joi.object().optional(),
23+
website: joi.string().optional()
2024
})
2125

2226
try {
@@ -30,6 +34,9 @@ const createUser = async (req, res, next) => {
3034

3135
const updateUser = async (req, res, next) => {
3236
const schema = joi.object().keys({
37+
phone: joi.string().optional(),
38+
email: joi.string().optional(),
39+
company_name: joi.string().optional(),
3340
username: joi.string().optional(),
3441
first_name: joi.string().optional(),
3542
last_name: joi.string().optional(),
@@ -44,7 +51,8 @@ const updateUser = async (req, res, next) => {
4451
instagram_id: joi.string().optional(),
4552
site: joi.string().optional(),
4653
isMember: joi.boolean().optional(),
47-
tokens: joi.object().optional()
54+
tokens: joi.object().optional(),
55+
website: joi.string().optional()
4856
})
4957

5058
try {

utils/generateAPISchema.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const swaggerDocs = require('./swaggerDefinition')
22
const fs = require('fs')
33

4+
// eslint-disable-next-line security/detect-non-literal-fs-filename
45
module.exports = fs.writeFileSync(
56
process.cwd() + '/public/apiSchema.json',
67
JSON.stringify(swaggerDocs)

0 commit comments

Comments
 (0)