itizawa 6 лет назад
Родитель
Сommit
2c425f8bfb
2 измененных файлов с 6 добавлено и 6 удалено
  1. 2 4
      src/server/models/user.js
  2. 4 2
      src/server/routes/apiv3/users.js

+ 2 - 4
src/server/models/user.js

@@ -332,7 +332,7 @@ module.exports = function(crowi) {
     });
   };
 
-  userSchema.methods.statusDelete = function(callback) {
+  userSchema.methods.statusDelete = function() {
     debug('Delete User', this);
 
     const now = new Date();
@@ -346,9 +346,7 @@ module.exports = function(crowi) {
     this.googleId = null;
     this.isGravatarEnabled = false;
     this.image = null;
-    this.save((err, userData) => {
-      return callback(err, userData);
-    });
+    return this.save();
   };
 
   userSchema.methods.updateGoogleId = function(googleId, callback) {

+ 4 - 2
src/server/routes/apiv3/users.js

@@ -92,8 +92,10 @@ module.exports = (crowi) => {
     const { id } = req.params;
 
     try {
-      const userData = await User.findById(id)
-      console.log(userData)
+      const userData = await User.findById(id);
+      await userData.statusDelete();
+
+      return res.apiv3({ userData });
     }
     catch (err) {
       return res.apiv3Err(new ErrorV3(err));