Jelajahi Sumber

重写fetch方法

reloaded 5 tahun lalu
induk
melakukan
79b798cf64
1 mengubah file dengan 8 tambahan dan 0 penghapusan
  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;