yusuketk 7 лет назад
Родитель
Сommit
d548303cdb
2 измененных файлов с 9 добавлено и 5 удалено
  1. 9 4
      src/server/models/page-tag-relation.js
  2. 0 1
      src/server/views/tags.html

+ 9 - 4
src/server/models/page-tag-relation.js

@@ -37,12 +37,17 @@ class PageTagRelation {
     }
   }
 
-  static async createTagListWithCount(opt) {
+  static async createTagListWithCount(option) {
+    const opt = option || {};
+    const sortOpt = opt.sortOpt || {};
+    const offset = opt.offset || 0;
+    const limit = opt.limit || 50;
+
     const list = await this.aggregate()
       .group({ _id: '$relatedTag', count: { $sum: 1 } })
-      .sort(opt.sortOpt)
-      .skip(opt.offset)
-      .limit(opt.limit);
+      .sort(sortOpt)
+      .skip(offset)
+      .limit(limit);
 
     return list;
   }

+ 0 - 1
src/server/views/tags.html

@@ -24,4 +24,3 @@
   {% include 'widget/system-version.html' %}
 </footer>
 {% endblock %} {# layout_main #}
-x