Quellcode durchsuchen

:recycle: rename response-keys to questions

neo
toj vor 2 Jahren
Ursprung
Commit
c3ca8cf8b0

+ 12
- 0
backend/lib/models/question.js Datei anzeigen

@@ -0,0 +1,12 @@
1
+const Schwifty = require('@hapipal/schwifty')
2
+
3
+const questionSchema = require('../schemas/questions')
4
+
5
+module.exports = class Question extends Schwifty.Model {
6
+    static get tableName() {
7
+        return 'questions'
8
+    }
9
+    static get joiSchema() {
10
+        return questionSchema.single
11
+    }
12
+}

+ 0
- 12
backend/lib/models/response-key.js Datei anzeigen

@@ -1,12 +0,0 @@
1
-const Schwifty = require('@hapipal/schwifty')
2
-
3
-const responseKeySchema = require('../schemas/response-keys')
4
-
5
-module.exports = class ResponseKey extends Schwifty.Model {
6
-    static get tableName() {
7
-        return 'response_keys'
8
-    }
9
-    static get joiSchema() {
10
-        return responseKeySchema.single
11
-    }
12
-}

backend/lib/schemas/response-keys.js → backend/lib/schemas/questions.js Datei anzeigen

@@ -9,20 +9,20 @@ const Joi = require('joi')
9 9
 
10 10
 // validator is used to validate route input/output
11 11
 const validator = Joi.object({
12
-    response_key_id: Joi.number().required(),
13
-    response_key_category: Joi.string().required(),
14
-    response_key_prompt: Joi.string().required(),
15
-    response_key_description: Joi.any()
12
+    question_id: Joi.number().required(),
13
+    question_category: Joi.string().required(),
14
+    question_prompt: Joi.string().required(),
15
+    question_description: Joi.any()
16 16
 }).label('question__single_validator')
17 17
 
18 18
 const list = Joi.array().items(validator).label('question__list_validator')
19 19
 
20 20
 // single is used to define database models
21 21
 const single = Joi.object({
22
-    response_key_id: Joi.number().required(),
23
-    response_key_category: Joi.string().required(),
24
-    response_key_prompt: Joi.string().required(),
25
-    response_key_description: Joi.any()
22
+    question_id: Joi.number().required(),
23
+    question_category: Joi.string().required(),
24
+    question_prompt: Joi.string().required(),
25
+    question_description: Joi.any()
26 26
 }).label('question__single')
27 27
 
28 28
 

Laden…
Abbrechen
Speichern