Parcourir la source

Create isExistUserByUserPagePath

Shun Miyazawa il y a 2 ans
Parent
commit
fb4438c752
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  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);