Skip to content

Commit

Permalink
Merge branch 'develop' into feature/client-react
Browse files Browse the repository at this point in the history
  • Loading branch information
rennemannd committed Apr 14, 2020
2 parents e4f6e89 + 64a5926 commit 66c2416
Show file tree
Hide file tree
Showing 177 changed files with 213,561 additions and 7 deletions.
64 changes: 64 additions & 0 deletions server/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
# Server

The server is composed of two parts: the admin panel and the api. It is built on top of [Strapi](https://strapi.io/documentation/3.0.0-beta.x/getting-started/introduction.html), a headless content management system. The file structure is documented [here](https://strapi.io/documentation/3.0.0-beta.x/concepts/file-structure.html#files-structure).



## Setup

### Installation

`yarn install`

### Developing

`yarn develop`



## Admin Panel `/admin`

Built with [React](https://reactjs.org/) and served by [Node](https://nodejs.org/en/), the admin panel allows for full customization of the server. Here you can create new content types and their corresponding endpoints, configure roles and permissions, and much more. The interface itself can be customized and configured as needed.

Read the full [documentation](https://strapi.io/documentation/3.0.0-beta.x/admin-panel/customization.html) on the admin panel.



## API `/`

Built with [Node](https://nodejs.org/en/), [Koa](https://github.com/koajs/koa#readme), and [Bookshelf](https://bookshelfjs.org/), the REST API enables CRUD functionality with the application's content. Authentication is enabled via JWTs. The current database is sqlite3 running locally.

### Entity Relationships

The content available via the API is modeled as follows.

![ER Digram](er_diagram.png)

### Endpoints

Each endpoint corresponds to an entity from the ER digram, a content type in the admin panel, a folder in the `./api` directory, and a database table.

| Endpoint | Note |
| ------------------- | ---- |
| activities | |
| blocks | |
| blocks-categories | |
| complexities | |
| difficulties | |
| learning-categories | |
| models | |
| topics | |
| types | |

Each and every endpoint can be interacted with by using the following method and path combinations.

| Method | Path | Description |
| ------ | ----------------- | --------------------- |
| GET | /{endpoint} | Get a list of entries |
| GET | /{endpoint}/:id | Get a specific entry |
| GET | /{endpoint}/count | Count entries |
| POST | /{endpoint} | Create a new entry |
| DELETE | /{endpoint}/:id | Delete an entry |
| PUT | /{endpoint}/:id | Update an entry |

Read the full [documentation](https://strapi.io/documentation/3.0.0-beta.x/content-api/api-endpoints.html#api-endpoints) on the api endpoints.

Empty file added server/api/.gitkeep
Empty file.
52 changes: 52 additions & 0 deletions server/api/activity/config/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"routes": [
{
"method": "GET",
"path": "/activities",
"handler": "activity.find",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/activities/count",
"handler": "activity.count",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/activities/:id",
"handler": "activity.findOne",
"config": {
"policies": []
}
},
{
"method": "POST",
"path": "/activities",
"handler": "activity.create",
"config": {
"policies": []
}
},
{
"method": "PUT",
"path": "/activities/:id",
"handler": "activity.update",
"config": {
"policies": []
}
},
{
"method": "DELETE",
"path": "/activities/:id",
"handler": "activity.delete",
"config": {
"policies": []
}
}
]
}
8 changes: 8 additions & 0 deletions server/api/activity/controllers/activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

/**
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/controllers.html#core-controllers)
* to customize this controller
*/

module.exports = {};
55 changes: 55 additions & 0 deletions server/api/activity/models/activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict';

/**
* Lifecycle callbacks for the `activity` model.
*/

module.exports = {
// Before saving a value.
// Fired before an `insert` or `update` query.
// beforeSave: async (model, attrs, options) => {},

// After saving a value.
// Fired after an `insert` or `update` query.
// afterSave: async (model, response, options) => {},

// Before fetching a value.
// Fired before a `fetch` operation.
// beforeFetch: async (model, columns, options) => {},

// After fetching a value.
// Fired after a `fetch` operation.
// afterFetch: async (model, response, options) => {},

// Before fetching all values.
// Fired before a `fetchAll` operation.
// beforeFetchAll: async (model, columns, options) => {},

// After fetching all values.
// Fired after a `fetchAll` operation.
// afterFetchAll: async (model, response, options) => {},

// Before creating a value.
// Fired before an `insert` query.
// beforeCreate: async (model, attrs, options) => {},

// After creating a value.
// Fired after an `insert` query.
// afterCreate: async (model, attrs, options) => {},

// Before updating a value.
// Fired before an `update` query.
// beforeUpdate: async (model, attrs, options) => {},

// After updating a value.
// Fired after an `update` query.
// afterUpdate: async (model, attrs, options) => {},

// Before destroying a value.
// Fired before a `delete` query.
// beforeDestroy: async (model, attrs, options) => {},

// After destroying a value.
// Fired after a `delete` query.
// afterDestroy: async (model, attrs, options) => {}
};
36 changes: 36 additions & 0 deletions server/api/activity/models/activity.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"kind": "collectionType",
"connection": "default",
"collectionName": "activities",
"info": {
"name": "activity"
},
"options": {
"increments": true,
"timestamps": true
},
"attributes": {
"name": {
"type": "string",
"required": true
},
"description": {
"type": "text"
},
"difficulty": {
"model": "difficulty"
},
"models": {
"collection": "model"
},
"blocks_categories": {
"collection": "blocks-category"
},
"learning_category": {
"model": "learning-category"
},
"topic": {
"model": "topic"
}
}
}
8 changes: 8 additions & 0 deletions server/api/activity/services/activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

/**
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/services.html#core-services)
* to customize this service
*/

module.exports = {};
52 changes: 52 additions & 0 deletions server/api/block/config/routes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"routes": [
{
"method": "GET",
"path": "/blocks",
"handler": "block.find",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/blocks/count",
"handler": "block.count",
"config": {
"policies": []
}
},
{
"method": "GET",
"path": "/blocks/:id",
"handler": "block.findOne",
"config": {
"policies": []
}
},
{
"method": "POST",
"path": "/blocks",
"handler": "block.create",
"config": {
"policies": []
}
},
{
"method": "PUT",
"path": "/blocks/:id",
"handler": "block.update",
"config": {
"policies": []
}
},
{
"method": "DELETE",
"path": "/blocks/:id",
"handler": "block.delete",
"config": {
"policies": []
}
}
]
}
8 changes: 8 additions & 0 deletions server/api/block/controllers/block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

/**
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/controllers.html#core-controllers)
* to customize this controller
*/

module.exports = {};
55 changes: 55 additions & 0 deletions server/api/block/models/block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'use strict';

/**
* Lifecycle callbacks for the `block` model.
*/

module.exports = {
// Before saving a value.
// Fired before an `insert` or `update` query.
// beforeSave: async (model, attrs, options) => {},

// After saving a value.
// Fired after an `insert` or `update` query.
// afterSave: async (model, response, options) => {},

// Before fetching a value.
// Fired before a `fetch` operation.
// beforeFetch: async (model, columns, options) => {},

// After fetching a value.
// Fired after a `fetch` operation.
// afterFetch: async (model, response, options) => {},

// Before fetching all values.
// Fired before a `fetchAll` operation.
// beforeFetchAll: async (model, columns, options) => {},

// After fetching all values.
// Fired after a `fetchAll` operation.
// afterFetchAll: async (model, response, options) => {},

// Before creating a value.
// Fired before an `insert` query.
// beforeCreate: async (model, attrs, options) => {},

// After creating a value.
// Fired after an `insert` query.
// afterCreate: async (model, attrs, options) => {},

// Before updating a value.
// Fired before an `update` query.
// beforeUpdate: async (model, attrs, options) => {},

// After updating a value.
// Fired after an `update` query.
// afterUpdate: async (model, attrs, options) => {},

// Before destroying a value.
// Fired before a `delete` query.
// beforeDestroy: async (model, attrs, options) => {},

// After destroying a value.
// Fired after a `delete` query.
// afterDestroy: async (model, attrs, options) => {}
};
20 changes: 20 additions & 0 deletions server/api/block/models/block.settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"kind": "collectionType",
"connection": "default",
"collectionName": "blocks",
"info": {
"name": "Block"
},
"options": {
"increments": true,
"timestamps": true
},
"attributes": {
"name": {
"type": "string"
},
"definition": {
"type": "text"
}
}
}
8 changes: 8 additions & 0 deletions server/api/block/services/block.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

/**
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/services.html#core-services)
* to customize this service
*/

module.exports = {};
Loading

0 comments on commit 66c2416

Please sign in to comment.