2013-12-25 16:36:33 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
2013-07-09 20:40:39 +03:00
|
|
|
/**
|
|
|
|
|
* Module dependencies.
|
|
|
|
|
*/
|
2013-08-16 15:23:09 -04:00
|
|
|
var mongoose = require('mongoose'),
|
2014-02-10 13:24:01 +02:00
|
|
|
Schema = mongoose.Schema;
|
2013-08-16 15:23:09 -04:00
|
|
|
|
2013-07-09 20:40:39 +03:00
|
|
|
/**
|
|
|
|
|
* Article Schema
|
|
|
|
|
*/
|
|
|
|
|
var ArticleSchema = new Schema({
|
2014-02-10 13:24:01 +02:00
|
|
|
created: {
|
|
|
|
|
type: Date,
|
|
|
|
|
default: Date.now
|
|
|
|
|
},
|
|
|
|
|
title: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
2014-04-02 19:16:40 +03:00
|
|
|
trim: true,
|
|
|
|
|
required: 'Title cannot be blank'
|
2014-02-10 13:24:01 +02:00
|
|
|
},
|
|
|
|
|
content: {
|
|
|
|
|
type: String,
|
|
|
|
|
default: '',
|
|
|
|
|
trim: true
|
|
|
|
|
},
|
|
|
|
|
user: {
|
|
|
|
|
type: Schema.ObjectId,
|
|
|
|
|
ref: 'User'
|
|
|
|
|
}
|
2013-07-09 20:40:39 +03:00
|
|
|
});
|
|
|
|
|
|
2015-02-16 21:35:33 +01:00
|
|
|
mongoose.model('Article', ArticleSchema);
|