p5.js-web-editor/server
Andrew Nicolaou 210e8b60bf Public API: Namespace private and public APIs (#1148)
* Converts import script to use public API endpoints

The endpoints don't exist yet, but this is a good way to see how
the implementation of the data structures differ.

* Exposes public API endpoint to fetch user's sketches

* Implements public API delete endpoint

* Adds helper to create custom ApplicationError classes

* Adds create project endpoint that understand API's data structure

This transforms the nested tree of file data into a mongoose
Project model

* Returns '201 Created' to match API spec

* Removes 'CustomError' variable assignment as it shows up in test output

* transformFiles will return file validation errors

* Tests API project controller

* Tests toModel()

* Creates default files if no root-level .html file is provided

* Do not auto-generate a slug if it is provided

Fixes a bug where the slug was auto-generated using the sketch name,
even if a slug property had been provided.

* Validates uniqueness of slugs for projects created by the public API

* Adds tests for slug uniqueness

* Configures node's Promise implementation for mongoose (fixes warnings)

* Moves createProject tests to match controller location

* Adds support for code to ApplicationErrors

* deleteProject controller tests

* getProjectsForUser controller tests

- implements tests
- update apiKey tests to use new User mocks

* Ensure error objects have consistent property names

`message` is used as a high-level description of the errors
`detail` is optional and has an plain language explanation of the
individual errors
`errors` is an array of each individual problem from `detail` in a
machine-readable format

* Assert environment variables are provided at script start

* Version public API

* Expect "files" property to always be provided

* Fixes linting error

* Converts import script to use public API endpoints

The endpoints don't exist yet, but this is a good way to see how
the implementation of the data structures differ.

* Exposes public API endpoint to fetch user's sketches

* Implements public API delete endpoint

* Adds helper to create custom ApplicationError classes

* Adds create project endpoint that understand API's data structure

This transforms the nested tree of file data into a mongoose
Project model

* Returns '201 Created' to match API spec

* Removes 'CustomError' variable assignment as it shows up in test output

* transformFiles will return file validation errors

* Tests API project controller

* Tests toModel()

* Creates default files if no root-level .html file is provided

* Do not auto-generate a slug if it is provided

Fixes a bug where the slug was auto-generated using the sketch name,
even if a slug property had been provided.

* Validates uniqueness of slugs for projects created by the public API

* Adds tests for slug uniqueness

* Configures node's Promise implementation for mongoose (fixes warnings)

* Moves createProject tests to match controller location

* deleteProject controller tests

* Adds support for code to ApplicationErrors

* getProjectsForUser controller tests

- implements tests
- update apiKey tests to use new User mocks

* Ensure error objects have consistent property names

`message` is used as a high-level description of the errors
`detail` is optional and has an plain language explanation of the
individual errors
`errors` is an array of each individual problem from `detail` in a
machine-readable format

* Assert environment variables are provided at script start

* Version public API

* Expect "files" property to always be provided

* Fixes linting error

* Checks that authenticated user has permission to create under this namespace

Previously, the project was always created under the authenticated user's
namespace, but this not obvious behaviour.

* Splits private and public APIs

The private API is under /editor and the public API under /api
2019-09-08 16:45:58 +02:00
..
config Fixes bug where lastUsedAt timestamp wasn't set when access token used 2019-05-29 12:51:50 -04:00
controllers Public API: Create new project (fixes #1095) (#1106) 2019-09-08 16:45:58 +02:00
domain-objects Public API: Create new project (fixes #1095) (#1106) 2019-09-08 16:45:58 +02:00
migrations for #950, update babel to v7 (#1077) 2019-06-05 12:05:31 -04:00
models Public API: Create new project (fixes #1095) (#1106) 2019-09-08 16:45:58 +02:00
routes Public API: Create new project (fixes #1095) (#1106) 2019-09-08 16:45:58 +02:00
scripts Public API: Create new project (fixes #1095) (#1106) 2019-09-08 16:45:58 +02:00
utils Public API: Create new project (fixes #1095) (#1106) 2019-09-08 16:45:58 +02:00
views Serve up an empty 404 page if no examples user (#766) 2019-01-25 14:12:39 -05:00
server.js Public API: Namespace private and public APIs (#1148) 2019-09-08 16:45:58 +02:00