|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
|
|
const debug = require('debug')('growi:models:bookmark');
|
|
const debug = require('debug')('growi:models:bookmark');
|
|
|
const mongoose = require('mongoose');
|
|
const mongoose = require('mongoose');
|
|
|
|
|
+const mongoosePaginate = require('mongoose-paginate-v2');
|
|
|
const uniqueValidator = require('mongoose-unique-validator');
|
|
const uniqueValidator = require('mongoose-unique-validator');
|
|
|
|
|
|
|
|
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
const ObjectId = mongoose.Schema.Types.ObjectId;
|
|
@@ -18,6 +19,7 @@ module.exports = function(crowi) {
|
|
|
createdAt: { type: Date, default: Date.now },
|
|
createdAt: { type: Date, default: Date.now },
|
|
|
});
|
|
});
|
|
|
bookmarkSchema.index({ page: 1, user: 1 }, { unique: true });
|
|
bookmarkSchema.index({ page: 1, user: 1 }, { unique: true });
|
|
|
|
|
+ bookmarkSchema.plugin(mongoosePaginate);
|
|
|
bookmarkSchema.plugin(uniqueValidator);
|
|
bookmarkSchema.plugin(uniqueValidator);
|
|
|
|
|
|
|
|
bookmarkSchema.statics.countByPageId = async function(pageId) {
|
|
bookmarkSchema.statics.countByPageId = async function(pageId) {
|