-
-
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
Changes from all commits
db9a703
766a160
76bcf9c
e77edb6
2919db4
4277ffc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Decided to change this to |
||
} | ||
|
||
function populateUserData(newProject) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. The limit on the front-end is actually 128 characters! |
||
user: { type: Schema.Types.ObjectId, ref: 'User' }, | ||
serveSecure: { type: Boolean, default: false }, | ||
files: { type: [fileSchema] }, | ||
|
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.