Procházet zdrojové kódy

Create isExistUserByUserPagePath

Shun Miyazawa před 2 roky
rodič
revize
fb4438c752
1 změnil soubory, kde provedl 7 přidání a 0 odebrání
  1. 7 0
      apps/app/src/server/models/user.js

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

@@ -710,6 +710,13 @@ module.exports = function(crowi) {
     return username;
   };
 
+  userSchema.statics.isExistUserByUserPagePath = async function(path) {
+    const username = this.getUsernameByPath(path);
+    const user = await this.findOne({ username });
+
+    return user != null;
+  };
+
   userSchema.statics.updateIsInvitationEmailSended = async function(id) {
     const user = await this.findById(id);