|
|
@@ -1,16 +1,29 @@
|
|
|
-module.exports = function(crowi) {
|
|
|
- var debug = require('debug')('growi:models:tag'),
|
|
|
- mongoose = require('mongoose'),
|
|
|
- ObjectId = mongoose.Schema.Types.ObjectId,
|
|
|
- USER_PUBLIC_FIELDS = '_id name',
|
|
|
- tagSchema;
|
|
|
+const mongoose = require('mongoose');
|
|
|
+const mongoosePaginate = require('mongoose-paginate');
|
|
|
+const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
|
+
|
|
|
+/*
|
|
|
+ * define schema
|
|
|
+ */
|
|
|
+const schema = new mongoose.Schema({
|
|
|
+ name: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+});
|
|
|
+schema.plugin(mongoosePaginate);
|
|
|
|
|
|
- tagSchema = new mongoose.Schema({
|
|
|
- name: {
|
|
|
- type: String,
|
|
|
- required: true
|
|
|
- },
|
|
|
- });
|
|
|
+/**
|
|
|
+ * Tag Class
|
|
|
+ *
|
|
|
+ * @class Tag
|
|
|
+ */
|
|
|
+class Tag {
|
|
|
+}
|
|
|
|
|
|
- return mongoose.model('Tag', tagSchema);
|
|
|
+module.exports = function(crowi) {
|
|
|
+ Tag.crowi = crowi;
|
|
|
+ schema.loadClass(Tag);
|
|
|
+ const model = mongoose.model('Tag', schema);
|
|
|
+ return model;
|
|
|
};
|