|
@@ -72,6 +72,18 @@ class UtilService extends CrudService {
|
|
|
const data = this.ctx.model[_model].prototype.schema.obj;
|
|
|
return data;
|
|
|
}
|
|
|
+ async utilMethod(data, body) {
|
|
|
+ console.log(data, body);
|
|
|
+ // const res = await this.ctx.model.Student.updateMany({ ...data, classid: { $exists: true } }, { classid: null });
|
|
|
+ const { code, ids, bedroomid } = body;
|
|
|
+ for (const id of ids) {
|
|
|
+ const r = await this.ctx.model.Student.findById(id);
|
|
|
+ r.bedroom = code;
|
|
|
+ r.bedroomid = bedroomid;
|
|
|
+ await r.save();
|
|
|
+ // await this.ctx.model.Student.findByIdAndUpdate(id, { bedroom: code, bedroomid });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
module.exports = UtilService;
|