Skip to content

Add character limit to sketch name on the back end #568 #1529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

joeyfurness
Copy link
Contributor

Fixes #568

I have verified that this pull request:

  • [x ] has no linting errors (npm run lint)
  • [x ] is from a uniquely-named feature branch and has been rebased on top of the latest master. (If I was asked to make more changes, I have made sure to rebase onto master then too)
  • [x ] is descriptively named and links to an issue number, i.e. Fixes #123

@welcome
Copy link

welcome bot commented Aug 3, 2020

🎉 Thanks for opening this pull request! Please check out our contributing guidelines if you haven't already.

@@ -30,14 +30,15 @@ export function updateProject(req, res) {
$set: req.body
},
{
new: true
new: true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For findOneByIdAndUpdate, you have to explicitly run the mongoose validators. I hate it.

@@ -9,7 +9,7 @@ export default function createProject(req, res) {
projectValues = Object.assign(projectValues, req.body);

function sendFailure() {
res.json({ success: false });
res.status(400).json({ success: false });
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to change this to 400 over 422 because it was more general? It would be really nice to get more granular with the error codes but since this function was called to handle different errors I thought 400 would be more appropriate.

@@ -29,7 +29,7 @@ fileSchema.set('toJSON', {

const projectSchema = new Schema(
{
name: { type: String, default: "Hello p5.js, it's the server" },
name: { type: String, default: "Hello p5.js, it's the server", maxlength: 128 },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The limit on the front-end is actually 128 characters!

@catarak
Copy link
Member

catarak commented Aug 3, 2020

In testing this I ended up adding some changes... do you want to test this on your end and see if it's working okay?

@joeyfurness
Copy link
Contributor Author

Yup i'll grab these changes and test and make another pull request if everything is working correctly

@joeyfurness
Copy link
Contributor Author

I'm new to working on open-source projects and working with git. Do your changes get automatically applied to my repo or do I need to merge them somehow?

@catarak
Copy link
Member

catarak commented Aug 4, 2020

I'm new to working on open-source projects and working with git. Do your changes get automatically applied to my repo or do I need to merge them somehow?

When you make this PR, it allows me to be able to push to the branch you want to merge in. So my changes should be pushed to your branch, you'll just need to pull the changes to your local repo.

@catarak
Copy link
Member

catarak commented Aug 4, 2020

Also welcome to contributing to open source and p5.js!!!

@joeyfurness
Copy link
Contributor Author

@catarak thanks !

I pulled your changes and tested them, everything looks like it's working as expected. Do I need to submit a new PR ?

@catarak
Copy link
Member

catarak commented Aug 5, 2020

I pulled your changes and tested them, everything looks like it's working as expected. Do I need to submit a new PR ?

No! The new changes got added to this PR so it's good to go 😄

@joeyfurness
Copy link
Contributor Author

Cool thanks for all your help 😃

@catarak catarak merged commit 17b2470 into processing:develop Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add character limit to sketch name - Back end validation
2 participants