summaryrefslogtreecommitdiff
path: root/server/lib/schemas/Documentation.js
blob: 35cf34f33c62badb550143e6520a4e9ae5a933ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;