From 1165ef5440e643252635aeea73a14cba0bb2e461 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 9 Jun 2014 16:14:49 -0400 Subject: documentation system --- server/lib/schemas/Documentation.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 server/lib/schemas/Documentation.js (limited to 'server/lib/schemas/Documentation.js') diff --git a/server/lib/schemas/Documentation.js b/server/lib/schemas/Documentation.js new file mode 100644 index 0000000..35cf34f --- /dev/null +++ b/server/lib/schemas/Documentation.js @@ -0,0 +1,33 @@ +/* jshint node: true */ + + +var mongoose = require('mongoose'), + _ = require('lodash'), + util = require('../util'); + +var DocumentationSchema = new mongoose.Schema({ + name: { + type: String, + required: true, + unique: true, + validate: [function (val){ + val = util.slugify(val || this.displayName || "") + if (! val.length) return false + if (val == "new") return false + return true + },"{PATH} name is required"] + }, + displayName: { + type: String, + }, + body: { + type: String, + default: "" + }, + created_at: { type: Date }, + updated_at: { type: Date }, +}); + + +module.exports = exports = mongoose.model('documentation', DocumentationSchema); +exports.schema = DocumentationSchema; -- cgit v1.2.3-70-g09d2