Преглед изворни кода

Create isExistUserByUserPagePath

Shun Miyazawa пре 2 година
родитељ
комит
fb4438c752
1 измењених фајлова са 7 додато и 0 уклоњено
  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;
     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) {
   userSchema.statics.updateIsInvitationEmailSended = async function(id) {
     const user = await this.findById(id);
     const user = await this.findById(id);