Commit graph

38 commits

Author SHA1 Message Date
Andrew Nicolaou
d44a058fd8 Public API: Create new project (fixes #1095) (#1106)
* 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.
2019-08-30 14:26:57 -04:00
Andrew Nicolaou
d2cad7438e
Test create project server code (prep for #1095)
* upgrades jest to latest version

* tests Project model with mockingoose

* extracts createProject controller to own file

* tests createProject controller with sinon-mongoose
2019-06-12 11:27:28 +02:00
Gaurang Tandon
bd3eed5fd3 reverted some changes and changed to file system safe naming 2019-02-10 06:57:03 +05:30
Gaurang Tandon
d86944034e fix lint errors 2018-12-15 12:43:58 +05:30
Gaurang Tandon
26d65396b4 fixes #568 2018-12-15 12:35:52 +05:30
Cassie Tarakajian
032169e7bc add authorization to file routes 2018-09-19 16:09:12 -04:00
Cassie Tarakajian
bd303b7710 fix even more linting errors 2018-05-08 19:16:04 -07:00
Cassie Tarakajian
3307613aec
adds slugify feature for #522 (#523) 2018-02-07 16:00:09 -05:00
Andrew Nicolaou
ae668f681e HTTPS UI switch (#335)
* Checkbox to toggle project's serveSecure flag

This doesn't yet persist or reload the page.

* Help button that shows modal to explain feature

* Extracts protocol redirection to helper

* Returns promise from saveProject() action to allow chaining

* Setting serveSecure flag on project redirects after saving project

* Set serveSecure on Project model in API and client

* Redirect to correct protocol when project is loaded
2017-05-03 11:46:12 -04:00
Cassie Tarakajian
e87390adb9 update eslint to latest version, fix lots of linting errors (#308)
* update eslint and dependencies, fix linting errors that can be fixed with --fix

* fix lots of linting errors

* update eslintrc, fix some linting errors

* fix all server side linting errors, untested

* fix errors that fixing linting errors had caused

* fix client side eslint errors

* fix client side linting errors

* fix refs lint errors

* fix more linting errors

* update eslint and dependencies, fix linting errors that can be fixed with --fix

* fix lots of linting errors

* update eslintrc, fix some linting errors

* fix all server side linting errors, untested

* fix errors that fixing linting errors had caused

* fix client side eslint errors

* fix client side linting errors

* fix refs lint errors

* fix more linting errors

* fix some accessibility linting errors

* fix a lot of linting errors

* fix a billion more linting errors

* hopefully fix all linting errors, still need to test

* fix bugs that fixing linting had caused
2017-02-22 14:29:35 -05:00
Cassie Tarakajian
fc8318c297 fix some linting errors 2017-01-11 15:50:36 -05:00
Cassie Tarakajian
9886e53a7c fix #245 2017-01-05 16:54:33 -05:00
Cassie Tarakajian
cb6256d3e3 #20 switch p5.js back to minified 2016-12-13 16:19:39 -05:00
Cassie Tarakajian
d0770739b1 update p5.js version and switch to non-minified versions 2016-12-13 16:08:23 -05:00
Cassie Tarakajian
af3cb60ce1 fix linting errors that are fixable with --fix in server side code 2016-11-17 11:15:35 -05:00
Cassie Tarakajian
588668886d update default version of p5 to 5.4 2016-11-02 15:06:28 -04:00
catarak
9e6d4b56bd change isSelected to isSelectedFile, add db reformat 2016-09-14 15:57:52 -04:00
catarak
1ae27f0d66 add file icons and file types default to file 2016-09-02 17:41:01 -04:00
catarak
3dfed2a11e delete files works, server side 2016-09-02 17:41:01 -04:00
catarak
d08c7c6b94 fix really really annoying bug 2016-09-02 17:41:01 -04:00
catarak
c8074f1501 do a lot of things that aren't really working 2016-09-02 17:41:01 -04:00
catarak
ac6585e713 add file works on unsaved project 2016-09-02 17:41:01 -04:00
catarak
40b70d6c69 add file node component 2016-09-02 17:41:00 -04:00
catarak
3bee1f8c37 fix bug with old p5.js version 2016-08-10 15:03:05 -04:00
catarak
625608ebbb when uploading file, add file to project 2016-07-19 18:27:27 -04:00
MathuraMG
038d290577 fix merge conflicts 2016-07-15 17:23:59 -04:00
catarak
9249d496fa add css files to sketch 2016-07-11 21:54:08 -04:00
catarak
7a164d9cdd multiple files rendering 2016-07-11 15:22:29 -04:00
catarak
7a84137e9b start to add selected file stuff 2016-07-08 14:57:22 -04:00
catarak
e06c821923 fix updating file to return all file keys 2016-07-07 13:50:52 -04:00
catarak
88531447ba add ids to files, fix update file action/reducer 2016-07-07 13:04:54 -04:00
catarak
6e12ed6524 fix default file on server, change file to files in lots of places 2016-07-06 17:29:07 -04:00
catarak
e6d94a0db8 start to add multiple file functionality 2016-07-06 15:09:05 -04:00
catarak
aa0637c256 fix bugs with saving/fetching projects 2016-06-29 12:52:16 -04:00
catarak
3d42da18a8 fix a ton of eslint errors 2016-06-23 18:29:55 -04:00
catarak
1045cddaeb figure out how redux-thunk works 2016-06-20 18:00:40 -04:00
catarak
e1a79ba7a6 start to add create project 2016-06-20 18:00:40 -04:00
catarak
165ad75e8b add project and file models, add project reducer and actions, add project name to toolbar, make project toolbar name contenteditable 2016-06-20 17:59:22 -04:00