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,6 +12,15 @@ const pluginConfig = {
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 24
 module.exports = {
16 25
     method: 'POST',
17 26
     path: '/send-email/',
@@ -58,6 +67,7 @@ module.exports = {
58 67
             }
59 68
         },
60 69
         validate: {
70
+            ...validators,
61 71
             failAction: 'log',
62 72
         },
63 73
         response: {

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

@@ -12,6 +12,16 @@ const pluginConfig = {
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 25
 module.exports = {
16 26
     method: 'POST',
17 27
     path: '/token',
@@ -47,6 +57,7 @@ module.exports = {
47 57
             }
48 58
         },
49 59
         validate: {
60
+            ...validators,
50 61
             failAction: 'log',
51 62
         },
52 63
         response: {

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

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

Loading…
Cancel
Save