Forráskód Böngészése

重写fetch方法

reloaded 5 éve
szülő
commit
79b798cf64
1 módosított fájl, 8 hozzáadás és 0 törlés
  1. 8 0
      app/service/staff.js

+ 8 - 0
app/service/staff.js

@@ -63,6 +63,14 @@ class StaffService extends CrudService {
     await this.umodel.findOneAndDelete({ userid: id });
   }
 
+  async fetch({ id }) {
+    let staff = await this.model.findById(id);
+    staff = JSON.parse(JSON.stringify(staff));
+    const user = await this.umodel.findOne({ userid: staff.id });
+    staff.type = user.type;
+    return staff;
+  }
+
 }
 
 module.exports = StaffService;