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); projectValues = Object.assign(projectValues, req.body);
// TODO: Error handling to match spec
function sendFailure() { function sendFailure() {
res.json({ success: false }); res.status(422).json({ success: false });
} }
function populateUserData(newProject) { function populateUserData(newProject) {

View file

@ -29,7 +29,7 @@ fileSchema.set('toJSON', {
const projectSchema = new Schema( 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' }, user: { type: Schema.Types.ObjectId, ref: 'User' },
serveSecure: { type: Boolean, default: false }, serveSecure: { type: Boolean, default: false },
files: { type: [fileSchema] }, files: { type: [fileSchema] },