p5.js-web-editor/server/models/project.js

17 lines
530 B
JavaScript
Raw Normal View History

import mongoose from 'mongoose';
const Schema = mongoose.Schema;
2016-06-17 22:40:13 +02:00
import shortid from 'shortid';
2016-06-17 20:11:52 +02:00
const fileSchema = new Schema({
name: {type: String, default: 'sketch.js'},
content: {type: String}
}, {timestamps: true});
const projectSchema = new Schema({
2016-06-17 20:11:52 +02:00
name: {type: String, default: "Hello p5.js, it's the server"},
user: {type: Schema.Types.ObjectId, ref: 'User'},
2016-06-17 22:40:13 +02:00
file: {type: fileSchema},
_id: {type: String, default: shortid.generate}
}, {timestamps: true});
export default mongoose.model('Project', projectSchema);