Commit graph

72 commits

Author SHA1 Message Date
Cassie Tarakajian
76bcf9cb09 [#1529] Send status codes, run validator 2020-08-03 16:42:28 -04:00
Cassie Tarakajian
6259f58233 [#1314][#1489] Add static methods to user model
- Add new static methods to user model
  - `findByEmailAndUsername`
  - renames `findByMailOrName` to `findByEmailOrUsername`
  - `findByUsername`
  - `findByEmail`
- Reverts case insensitive behavior for username
2020-07-15 17:33:11 -04:00
Cassie Tarakajian
15ad07d5ce [#1314][#1489] Use collation instead of RegEx
- Add case insensitive indexes for User.email and User.username
- Update user queries by username or email so that they are case
  insensitive
2020-07-14 18:16:17 -04:00
Cassie Tarakajian
47e798a7e6 Fixes #1409 - adds username to url when fetching sketch from editor API 2020-05-26 17:35:13 -04:00
Cassie Tarakajian
ce653ceebb Fixes #850: 503 error when downloading sketch 2020-04-15 17:39:28 -04:00
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
Laksh Singla
c3856480b8 Update sketch list styling (#819)
* parent b3c3efcec9
author Laksh Singla <lakshsingla@gmail.com> 1549106083 +0530
committer Cassie Tarakajian <ctarakajian@gmail.com> 1560540243 -0400

parent b3c3efcec9
author Laksh Singla <lakshsingla@gmail.com> 1549106083 +0530
committer Cassie Tarakajian <ctarakajian@gmail.com> 1560540198 -0400

parent b3c3efcec9
author Laksh Singla <lakshsingla@gmail.com> 1549106083 +0530
committer Cassie Tarakajian <ctarakajian@gmail.com> 1560539667 -0400

Created initial html structure and styling for new SketchList design

Final styling of ActionDialogueBox commplete

Dropdown menu disappearing while clicking anywhere on the table

Fixed linting issues and renamed variables

Minor tweaks in the SketchList dropdown dialogue UI

Themifyed the dropdown

Made changes in the dropdown: Arrow positioned slightly updwards, Removed blank space and added box-shadow in dropdown, themifyed dropdowns dashed border color

Added Delete and Share functionality to Dialog box

Added Duplicate functionality to Dialog box

Added download functionality to Dialog box

SketchList does not open a sketch if dialogue box is opened

SketchList Rename initial UI completed

Enter key handled for rename project option

[WIP] Updating rename functionality

Download option now working for all the sketches

Duplicate functionality extended for non opened sketches too

Modified overlay behaviour to close only the last overlay

Share modal can now display different projects

Dropdown closes when Share and Delete are closing for a more natural UX

fix broken files from rebasing

Created initial html structure and styling for new SketchList design

Final styling of ActionDialogueBox commplete

Added Delete and Share functionality to Dialog box

Added Duplicate functionality to Dialog box

[WIP] Updating rename functionality

Duplicate functionality extended for non opened sketches too

Modified overlay behaviour to close only the last overlay

Share modal can now display different projects

Final styling of ActionDialogueBox commplete

Fixed linting issues and renamed variables

Minor tweaks in the SketchList dropdown dialogue UI

Themifyed the dropdown

Added Delete and Share functionality to Dialog box

[WIP] Updating rename functionality

Modified overlay behaviour to close only the last overlay

Share modal can now display different projects

Dropdown closes when Share and Delete are closing for a more natural UX

fix broken files from rebasing

Final styling of ActionDialogueBox commplete

Minor tweaks in the SketchList dropdown dialogue UI

Themifyed the dropdown

[WIP] Updating rename functionality

Duplicate functionality extended for non opened sketches too

Modified overlay behaviour to close only the last overlay

Share modal can now display different projects

Dropdown closes when Share and Delete are closing for a more natural UX

* fix bugs in merge commit

* move sketch list dialogue to ul/li

* update sketch option dropdown to use dropdown placeholder, remove unused css

* major refactor of sketchlist component, fix showShareModal action, minor updates ot icon sizing

* fix broken links on asset list

* remove unused image, fix options for different users in sketch list
2019-07-22 16:09:11 -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
Cassie Tarakajian
df1219b47a
fixes #850, bundling external libraries was causing a callback to never be called (#1060) 2019-05-02 19:33:16 -04:00
Cassie Tarakajian
7d1901649f
Project synching, for #790 (#1039)
* add isSaving to project reducer, move actions to functions, start work to get comprehensive frontend/backend syncing working

* handle making changes while saving project, handle saving from another window

* add change to handle saving new sketch, and adding new changes while saving
2019-04-17 14:08:33 -04:00
Ankur Ingale
80765e03c7 Fixed Issue #659 (#964)
* Fixed Issue #659

* Undo changes in package.json and package-lock.json

* Resolved error
2019-03-21 17:08:46 -04:00
siddhant1
b6e2c4c983 Migrated from momentjs to date-fns 2019-03-02 15:05:40 +05:30
Oliver Wright
03d7533e2a Serve text-type assets from sketch asset urls - Fixes #839 (#843) 2019-02-22 18:05:56 -05:00
Oliver Wright
e75c98b299 Prevent Race Condition when Updating Project - Fixes #837 (#838) 2019-02-20 16:27:28 -05:00
Gaurang Tandon
bd3eed5fd3 reverted some changes and changed to file system safe naming 2019-02-10 06:57:03 +05:30
Gaurang Tandon
26d65396b4 fixes #568 2018-12-15 12:35:52 +05:30
Cassie Tarakajian
bd303b7710 fix even more linting errors 2018-05-08 19:16:04 -07:00
Cassie Tarakajian
c90dac55b7 update eslint and fix linting errors 2018-05-08 19:16:04 -07:00
Cassie Tarakajian
e70b9d618e fix linting errors 2018-02-20 14:22:33 -05:00
Cassie Tarakajian
f05abfcb9a fix for #552 2018-02-20 14:16:58 -05:00
Mr.tang
27d4013585 Fixes #520 (#538)
* Fix #520

* delete consoles

* restore

* return 404 from server side

* fix lint error

* add sketch check for user
2018-02-19 15:21:47 -05:00
Mr.tang
6f5472020c Fixes #517 (#530)
* update download file's name

* fix lint error

* use moment.js

* slugify filename

* fix lint error
2018-02-13 11:28:06 -05:00
Cassie Tarakajian
3307613aec
adds slugify feature for #522 (#523) 2018-02-07 16:00:09 -05:00
Cassie Tarakajian
fb1684ce4b add isAuthenticated middleware, add isAuthenticated middleware to certain routes, make all other routes consistent 2018-01-09 15:57:49 -05:00
Cassie Tarakajian
28c2bda663 remove console logs to figure out getProjectAsset crash 2017-11-27 16:06:59 -05:00
Cassie Tarakajian
286c725407 add more debugging to getProjectAsset 2017-11-27 15:43:58 -05:00
Cassie Tarakajian
3b33f3acca catch getProjectAsset error 2017-11-27 15:14:50 -05:00
Cassie Tarakajian
c30aba8e78 fix lingering linting errors 2017-10-15 20:27:05 -07:00
Cassie Tarakajian
63b47319d4 fix merge conflict 2017-08-01 16:07:21 -04:00
Zach Rispoli
e987e8f483 Bundle libraries when project is downloaded as zip (New approach) (#376)
* External libraries are bundled with zip when project is downloaded (#44)

* Fix linting errors

* Add a check for valid URLs before trying to bundle a library into project

* Add is-url lib to package.json
2017-07-19 19:56:52 +02:00
Cassie Tarakajian
e140702784 Create Asset List View and refactor overlay code (#356)
* start to create asset list

* begin refactoring overlay component to remove duplicate code

* refactoring of overlays, asset list styles

* changes to add size to asset list

* fixes to asset list

* handle case in which a user hasn't uploaded any assets

* fix bug in which asset list only grabbed first asset

* remove console.log

* update overlay exit styling to use icon mixin
2017-07-11 17:37:43 +02:00
Cassie Tarakajian
1ae37ebaaa fix lingering linting errors 2017-06-13 16:47:36 -04:00
Zach Rispoli
396fc701c7 Fix issue with serving assets inside folders 2017-06-12 13:49:45 -04:00
Zach Rispoli
61afce46ed Server can serve individual assets from projects (fixes #212, fixes #219) 2017-06-01 00:08:11 -04:00
Cassie Tarakajian
40b3e26f24 #339 make duplication backwards compatible with old s3 links 2017-04-13 14:17:30 -04:00
Cassie Tarakajian
aaa5e868e2 make inital changes for #169--need to migrate the locations of a user's s3 files to be namespaced under their userid 2017-04-06 14:34:14 -04:00
Cassie Tarakajian
23560c7879 delete file from s3 if data environment variable is undefined 2017-04-05 23:23:38 -04:00
Cassie Tarakajian
8392acdf3f delete files based on S3, with a date to be backwards compatible 2017-04-05 23:23:38 -04:00
Cassie Tarakajian
1e49b678c4 temporarily remove stale project thing 2017-03-15 11:59:07 -04:00
Cassie Tarakajian
abbeb7fc60 fi linting to include .jsx files 2017-03-02 15:18:58 -05:00
Cassie Tarakajian
fe4c2641e3 fix #254, stale project warning works correctly, removed unused actions and state for ide 2017-03-02 14:38:29 -05: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
a59efb2583 #254 remove warning for stale project, needs to be tested more 2017-01-25 13:39:20 -05:00
Cassie Tarakajian
0c6246fe45 fix linting errors 2017-01-24 17:20:40 -05:00
Cassie Tarakajian
a9ee70e033 #254 show error when user attempts to save stale version of project, refactor error modals to one component 2017-01-24 15:29:25 -05:00
Cassie Tarakajian
1a22998ff8 warn user of session change when deleting a project or saving a new project 2017-01-17 15:37:19 -05:00
Cassie Tarakajian
65592cbf9e add authentcation error component, return 403 error from server when trying to save a project where the user doesn't match the owner 2017-01-17 15:37:19 -05:00
Enrique Piqueras
5e4b076b93 Fixed #158 and #100 (#198)
* Changed unsaved changes asterisk to an svg circle. #158

* Fixed #100
Unmatched routes are handled by react-router on the client side
and a single wildcard route on server.routes.js renders the index
html.
When the /:username/sketches route is matched and the username is not
valid, the user will be redirected to the index route and a toast
will explain what happened. When the username is 'p5' (default when
logged out) it will show all sketches. Maybe this should be changed
to just public or 'local' sketches?

* Moved unsaved changes SVG to a separate file.

* User not found is now a 404 error.

* Added server rendered 404 page.

* Removed console.log

* 404 Page now renders a random p5 sketch. TODO: make 404 sketches.

* Added 404 header
404 page now fetches a random example sketch

* Moved circle closer to file name

* Render 404 page in SketchList route if !user
2017-01-06 13:08:03 -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
85b8f5b589 fixes #96, downloads now work on safari and firefox 2016-11-02 14:08:53 -04:00