From 5731e89c1fb07739c1eaab4410bee919f28e6da1 Mon Sep 17 00:00:00 2001 From: Dakota Rennemann Date: Tue, 9 Feb 2021 08:22:50 -0500 Subject: [PATCH] Opening /api/challenge endpoint for interviews --- server/api/challenge/config/routes.json | 28 +++++ server/api/challenge/controllers/challenge.js | 113 ++++++++++++++++++ server/api/challenge/models/challenge.js | 8 ++ .../challenge/models/challenge.settings.json | 16 +++ server/api/challenge/services/challenge.js | 8 ++ 5 files changed, 173 insertions(+) create mode 100644 server/api/challenge/config/routes.json create mode 100644 server/api/challenge/controllers/challenge.js create mode 100644 server/api/challenge/models/challenge.js create mode 100644 server/api/challenge/models/challenge.settings.json create mode 100644 server/api/challenge/services/challenge.js diff --git a/server/api/challenge/config/routes.json b/server/api/challenge/config/routes.json new file mode 100644 index 00000000..a9ddaae5 --- /dev/null +++ b/server/api/challenge/config/routes.json @@ -0,0 +1,28 @@ +{ + "routes": [ + { + "method": "GET", + "path": "/challenge", + "handler": "challenge.find", + "config": { + "policies": [] + } + }, + { + "method": "PUT", + "path": "/challenge", + "handler": "challenge.update", + "config": { + "policies": [] + } + }, + { + "method": "DELETE", + "path": "/challenge", + "handler": "challenge.delete", + "config": { + "policies": [] + } + } + ] +} diff --git a/server/api/challenge/controllers/challenge.js b/server/api/challenge/controllers/challenge.js new file mode 100644 index 00000000..7f9d33d2 --- /dev/null +++ b/server/api/challenge/controllers/challenge.js @@ -0,0 +1,113 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/v3.x/concepts/controllers.html#core-controllers) + * to customize this controller + */ + +module.exports = { + async find() { + return [ + { + "id": 1, + "name": "Topic #1", + "description": "This is it", + "type": 1, + "created_at": "2020-04-14T04:52:39.000Z", + "updated_at": "2020-05-26T02:13:47.153Z", + "activities": [ + { + "id": 4, + "name": "Activity #3", + "description": "This is the third activity, meant to show off just the Control block category.", + "difficulty": { + "id": 1, + "name": "LOW", + "created_at": "2020-03-31T15:47:22.000Z", + "updated_at": "2020-03-31T15:47:22.000Z" + }, + "learning_category": { + "id": 3, + "name": "MAKER_TOOLS", + "created_at": "2020-03-31T15:45:14.000Z", + "updated_at": "2020-03-31T15:45:14.000Z" + }, + "topic": 1, + "created_at": "2020-04-02T15:15:34.000Z", + "updated_at": "2020-05-26T02:13:47.151Z" + } + ] + }, + { + "id": 2, + "name": "Topic #2", + "description": "This is it", + "type": 2, + "created_at": "2020-04-14T04:52:46.000Z", + "updated_at": "2020-05-26T02:13:39.054Z", + "activities": [ + { + "id": 2, + "name": "Activity #1", + "description": "This is the first activity, meant to show off two of the categories in the toolbox.", + "difficulty": { + "id": 2, + "name": "MEDIUM", + "created_at": "2020-03-31T15:47:26.000Z", + "updated_at": "2020-03-31T15:47:26.000Z" + }, + "learning_category": { + "id": 1, + "name": "ENABLED_LEARNING", + "created_at": "2020-03-31T15:45:01.000Z", + "updated_at": "2020-03-31T15:45:01.000Z" + }, + "topic": 2, + "created_at": "2020-03-31T15:56:45.000Z", + "updated_at": "2020-05-26T02:13:39.052Z" + }, + { + "id": 3, + "name": "Activity #2", + "description": "This is the second activity, meant to show off just the logic block category.", + "difficulty": { + "id": 2, + "name": "MEDIUM", + "created_at": "2020-03-31T15:47:26.000Z", + "updated_at": "2020-03-31T15:47:26.000Z" + }, + "learning_category": { + "id": 2, + "name": "DEMONSTRATE_LEARNING", + "created_at": "2020-03-31T15:45:10.000Z", + "updated_at": "2020-03-31T15:45:10.000Z" + }, + "topic": 2, + "created_at": "2020-03-31T18:07:23.000Z", + "updated_at": "2020-05-26T02:13:39.052Z" + }, + { + "id": 5, + "name": "Activity #5", + "description": "This is the fifth activity, meant to show off every possible category in the toolbox.", + "difficulty": { + "id": 3, + "name": "HIGH", + "created_at": "2020-03-31T15:47:29.000Z", + "updated_at": "2020-03-31T15:47:29.000Z" + }, + "learning_category": { + "id": 1, + "name": "ENABLED_LEARNING", + "created_at": "2020-03-31T15:45:01.000Z", + "updated_at": "2020-03-31T15:45:01.000Z" + }, + "topic": 2, + "created_at": "2020-04-15T21:30:02.000Z", + "updated_at": "2020-05-26T02:13:39.052Z" + } + ] + } + ] + }, +}; diff --git a/server/api/challenge/models/challenge.js b/server/api/challenge/models/challenge.js new file mode 100644 index 00000000..4133599f --- /dev/null +++ b/server/api/challenge/models/challenge.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/v3.x/concepts/models.html#life-cycle-callbacks) + * to customize this model + */ + +module.exports = {}; diff --git a/server/api/challenge/models/challenge.settings.json b/server/api/challenge/models/challenge.settings.json new file mode 100644 index 00000000..1a58fd5d --- /dev/null +++ b/server/api/challenge/models/challenge.settings.json @@ -0,0 +1,16 @@ +{ + "kind": "singleType", + "collectionName": "challenges", + "info": { + "name": "Challenge" + }, + "options": { + "increments": true, + "timestamps": true + }, + "attributes": { + "name": { + "type": "string" + } + } +} diff --git a/server/api/challenge/services/challenge.js b/server/api/challenge/services/challenge.js new file mode 100644 index 00000000..1f5330ef --- /dev/null +++ b/server/api/challenge/services/challenge.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * Read the documentation (https://strapi.io/documentation/v3.x/concepts/services.html#core-services) + * to customize this service + */ + +module.exports = {};