-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add character limit to sketch name on the back end #568 #1529
Conversation
🎉 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, |
There was a problem hiding this comment.
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 }); |
There was a problem hiding this comment.
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 }, |
There was a problem hiding this comment.
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!
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? |
Yup i'll grab these changes and test and make another pull request if everything is working correctly |
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. |
Also welcome to contributing to open source and p5.js!!! |
@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 ? |
No! The new changes got added to this PR so it's good to go 😄 |
Cool thanks for all your help 😃 |
Fixes #568
I have verified that this pull request:
npm run lint
)Fixes #123