@tomei/rental 0.17.4-dev.10 → 0.17.4-dev.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomei/rental",
3
- "version": "0.17.4-dev.10",
3
+ "version": "0.17.4-dev.12",
4
4
  "description": "Tomei Rental Package",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -236,8 +236,8 @@ export class JointHirer extends ObjectBase {
236
236
  'RentalId is empty.',
237
237
  );
238
238
  }
239
- console.log('JointHirer getRental', this.RentalId);
240
- this._Rental = await Rental.init(this.RentalId, dbTransaction);
239
+
240
+ this._Rental = await Rental.init(dbTransaction, this.RentalId);
241
241
 
242
242
  if (!this._Rental) {
243
243
  throw new ClassError(
@@ -128,7 +128,6 @@ export class Rental extends ObjectBase {
128
128
  }
129
129
  return new Rental();
130
130
  } catch (error) {
131
- console.error('Error initializing Rental:', error);
132
131
  throw new ClassError(
133
132
  'Rental',
134
133
  'RentalErrMsg00',
@@ -749,6 +748,7 @@ export class Rental extends ObjectBase {
749
748
  const jointHirers = await Rental._JointHirerRepo.findAll({
750
749
  where: {
751
750
  RentalId: this.RentalId,
751
+ Status: 'Active',
752
752
  },
753
753
  transaction: dbTransaction,
754
754
  });
@@ -808,12 +808,6 @@ export class RentalHirerChangeRequest
808
808
  jointHirer.CustomerId = customerId;
809
809
  jointHirer.CustomerType = customerType;
810
810
  await jointHirer.create(loginUser, dbTransaction);
811
-
812
- //d. Set the AccountType to "Joint" for the rental
813
- // const rental = await Rental.init(dbTransaction, this.RentalId);
814
- // await rental.update(loginUser, dbTransaction, {
815
- // AccountType: RentalAccountTypeEnum.JOINT,
816
- // });
817
811
  } else if (this.Type === HirerChangeRequestTypeEnum.REMOVE) {
818
812
  // a. Get joint hirer from remove hirer request
819
813
  const removeHirer = await this.getRemoveHirer(dbTransaction);
@@ -824,23 +818,6 @@ export class RentalHirerChangeRequest
824
818
 
825
819
  //Call jointHirer.remove() method by passing loginUser and dbTransaction
826
820
  await jointHirer.remove(loginUser, dbTransaction);
827
-
828
- // //find the number of joint hirers after removal
829
- // const rental = await Rental.init(dbTransaction, this.RentalId);
830
- // rental.AccountType = RentalAccountTypeEnum.JOINT;
831
- // const jointHirers = await rental.getJointHirers(dbTransaction);
832
-
833
- // //filter out the active joint hirers
834
- // const activeJointHirers = jointHirers.filter(
835
- // (hirer) => hirer.Status === 'Active',
836
- // );
837
-
838
- // //if jointHirers is empty, set rental.AccountType to "Single"
839
- // if (activeJointHirers.length === 0) {
840
- // await rental.update(loginUser, dbTransaction, {
841
- // AccountType: RentalAccountTypeEnum.SINGLE,
842
- // });
843
- // }
844
821
  }
845
822
 
846
823
  // 3. Call _Repo update method