Przeglądaj źródła

add countListByStatus

Seiya Tashiro 7 lat temu
rodzic
commit
3269d19f8b
1 zmienionych plików z 7 dodań i 0 usunięć
  1. 7 0
      src/server/models/user.js

+ 7 - 0
src/server/models/user.js

@@ -518,6 +518,13 @@ module.exports = function(crowi) {
     return isUserCountExceedsUpperLimit;
   };
 
+  userSchema.statics.countListByStatus = async function(status) {
+    const User = this;
+    const conditions = {status: status};
+
+    return User.find(conditions).count();
+  };
+
   userSchema.statics.isRegisterableUsername = async function(username) {
     var User = this;
     var usernameUsable = true;