lrf 2 năm trước cách đây
mục cha
commit
a2e40a0017
1 tập tin đã thay đổi với 1 bổ sung2 xóa
  1. 1 2
      app/service/user/address.js

+ 1 - 2
app/service/user/address.js

@@ -24,8 +24,7 @@ class AddressService extends CrudService {
     if (!data) throw new BusinessError(ErrorCode.DATA_NOT_EXIST);
     const { customer } = data;
     await this.model.updateMany({ customer }, { is_default: this.defaultValue });
-    data.is_default = '1';
-    await data.save();
+    await this.model.updateOne({ _id: id }, { is_default: '1' });
   }
 }