move files around
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const {createResponse} = require('../../helpers');
|
||||
const {parseAndValidateBody} = require('../../validators');
|
||||
const {courseSchema} = require('../../validators/schemas');
|
||||
const courseSchema = require('./schema');
|
||||
const {COURSES_TABLE} = require('../../constants');
|
||||
const db = require('../../services/db');
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
const courseSchema = {
|
||||
module.exports.default = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"type": "string"},
|
||||
"num_tests": {"type": "number"},
|
||||
"num_questions_per_test": {"type": "number"},
|
||||
"answers": {"type": "array"}
|
||||
"answers": {
|
||||
"type": "array",
|
||||
"items": { "type": "string" }
|
||||
}
|
||||
},
|
||||
"required": ["name", "num_tests", "num_questions_per_test", "answers"]
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
courseSchema
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
const dynamoClient = require('../dynamoClient');
|
||||
const dynamoClient = require('./dynamoClient');
|
||||
|
||||
const create = async (tableName, item) => {
|
||||
const fullItem = {...item, created_at: Date.now()};
|
||||
@@ -20,7 +20,7 @@ const parseAndValidateBody = async (schema, body) => {
|
||||
};
|
||||
|
||||
const validateBody = (schema, body) => {
|
||||
const ajv = new Ajv();
|
||||
const ajv = new Ajv({$data: true});
|
||||
const validate = ajv.compile(schema);
|
||||
const isValid = validate(body);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user