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

This commit is contained in:
josephmwells 2020-08-03 11:40:48 -07:00
parent 05e43c70b7
commit db9a703def
2 changed files with 3 additions and 2 deletions

View File

@ -8,8 +8,9 @@ export default function createProject(req, res) {
projectValues = Object.assign(projectValues, req.body);
// TODO: Error handling to match spec
function sendFailure() {
res.json({ success: false });
res.status(422).json({ success: false });
}
function populateUserData(newProject) {

View File

@ -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: 256 },
user: { type: Schema.Types.ObjectId, ref: 'User' },
serveSecure: { type: Boolean, default: false },
files: { type: [fileSchema] },