Browse Source

:bug: Fixed validation error logs

juan-filtering-match-pool
tomit4 2 years ago
parent
commit
76d442c283

+ 10
- 0
backend/lib/routes/user/send-email.js View File

12
     },
12
     },
13
 }
13
 }
14
 
14
 
15
+const validators = {
16
+    payload: Joi.object({
17
+        email: Joi.string(),
18
+        name: Joi.string(),
19
+        seeking: Joi.string(),
20
+        sessionToken: Joi.string(),
21
+    }),
22
+}
23
+
15
 module.exports = {
24
 module.exports = {
16
     method: 'POST',
25
     method: 'POST',
17
     path: '/send-email/',
26
     path: '/send-email/',
58
             }
67
             }
59
         },
68
         },
60
         validate: {
69
         validate: {
70
+            ...validators,
61
             failAction: 'log',
71
             failAction: 'log',
62
         },
72
         },
63
         response: {
73
         response: {

+ 11
- 0
backend/lib/routes/user/token.js View File

12
     },
12
     },
13
 }
13
 }
14
 
14
 
15
+const validators = {
16
+    payload: Joi.object({
17
+        payload: Joi.object({
18
+            email: Joi.string(),
19
+            name: Joi.string(),
20
+            seeking: Joi.string(),
21
+        }),
22
+    }),
23
+}
24
+
15
 module.exports = {
25
 module.exports = {
16
     method: 'POST',
26
     method: 'POST',
17
     path: '/token',
27
     path: '/token',
47
             }
57
             }
48
         },
58
         },
49
         validate: {
59
         validate: {
60
+            ...validators,
50
             failAction: 'log',
61
             failAction: 'log',
51
         },
62
         },
52
         response: {
63
         response: {

+ 5
- 1
backend/lib/routes/user/validate-session.js View File

1
 'use strict'
1
 'use strict'
2
 
2
 
3
-const { plugin } = require('@hapi/inert')
4
 const Joi = require('joi')
3
 const Joi = require('joi')
5
 
4
 
6
 const pluginConfig = {
5
 const pluginConfig = {
13
     },
12
     },
14
 }
13
 }
15
 
14
 
15
+const validators = {
16
+    payload: Joi.string(),
17
+}
18
+
16
 module.exports = {
19
 module.exports = {
17
     method: 'POST',
20
     method: 'POST',
18
     path: '/validate-session',
21
     path: '/validate-session',
57
             }
60
             }
58
         },
61
         },
59
         validate: {
62
         validate: {
63
+            ...validators,
60
             failAction: 'log',
64
             failAction: 'log',
61
         },
65
         },
62
         response: {
66
         response: {

Loading…
Cancel
Save