|
@@ -68,6 +68,22 @@ class StaffService extends CrudService {
|
|
await this.umodel.findOneAndDelete({ userid: id });
|
|
await this.umodel.findOneAndDelete({ userid: id });
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ async query({ skip, limit, ...info }) {
|
|
|
|
+ const total = await (await this.model.find(info)).length;
|
|
|
|
+ const staffs = await this.model
|
|
|
|
+ .find(info)
|
|
|
|
+ .skip(Number(skip))
|
|
|
|
+ .limit(Number(limit));
|
|
|
|
+ const newdata = [];
|
|
|
|
+ for (let staff of staffs) {
|
|
|
|
+ staff = JSON.parse(JSON.stringify(staff));
|
|
|
|
+ const user = await this.umodel.findOne({ userid: staff.id });
|
|
|
|
+ staff.type = user.type;
|
|
|
|
+ newdata.push(staff);
|
|
|
|
+ }
|
|
|
|
+ return { data: newdata, total };
|
|
|
|
+ }
|
|
|
|
+
|
|
async fetch({ id }) {
|
|
async fetch({ id }) {
|
|
let staff = await this.model.findById(id);
|
|
let staff = await this.model.findById(id);
|
|
staff = JSON.parse(JSON.stringify(staff));
|
|
staff = JSON.parse(JSON.stringify(staff));
|