@shisyamo4131/air-guard-v2-schemas 2.3.7-dev.3 → 2.3.7-dev.5
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
package/src/OperationResult.js
CHANGED
|
@@ -541,11 +541,11 @@ export default class OperationResult extends Operation {
|
|
|
541
541
|
}
|
|
542
542
|
|
|
543
543
|
/**
|
|
544
|
-
* Synchronize customerId from siteId
|
|
544
|
+
* Synchronize customerId and apply (re-apply) agreement from siteId
|
|
545
545
|
* @returns {Promise<void>}
|
|
546
546
|
* @throws {Error} If the specified siteId does not exist
|
|
547
547
|
*/
|
|
548
|
-
async
|
|
548
|
+
async _syncCustomerIdAndApplyAgreement() {
|
|
549
549
|
if (!this.siteId) return;
|
|
550
550
|
const siteInstance = new Site();
|
|
551
551
|
const siteExists = await siteInstance.fetch({ docId: this.siteId });
|
|
@@ -555,6 +555,7 @@ export default class OperationResult extends Operation {
|
|
|
555
555
|
);
|
|
556
556
|
}
|
|
557
557
|
this.customerId = siteInstance.customerId;
|
|
558
|
+
this.agreement = siteInstance.getCurrentAgreement(this);
|
|
558
559
|
}
|
|
559
560
|
|
|
560
561
|
/**
|
|
@@ -564,12 +565,12 @@ export default class OperationResult extends Operation {
|
|
|
564
565
|
async beforeCreate() {
|
|
565
566
|
await super.beforeCreate();
|
|
566
567
|
|
|
567
|
-
// Sync customerId
|
|
568
|
-
await this.
|
|
568
|
+
// Sync customerId and apply agreement
|
|
569
|
+
await this._syncCustomerIdAndApplyAgreement();
|
|
569
570
|
}
|
|
570
571
|
|
|
571
572
|
/**
|
|
572
|
-
* Override beforeUpdate to sync customerId if
|
|
573
|
+
* Override beforeUpdate to sync customerId and apply agreement if key changed
|
|
573
574
|
* @returns {Promise<void>}
|
|
574
575
|
*/
|
|
575
576
|
async beforeUpdate() {
|
|
@@ -582,9 +583,9 @@ export default class OperationResult extends Operation {
|
|
|
582
583
|
);
|
|
583
584
|
}
|
|
584
585
|
|
|
585
|
-
// Sync customerId if
|
|
586
|
-
if (this.
|
|
587
|
-
await this.
|
|
586
|
+
// Sync customerId and apply agreement if key changed
|
|
587
|
+
if (this.key === this._beforeData.key) return;
|
|
588
|
+
await this._syncCustomerIdAndApplyAgreement();
|
|
588
589
|
}
|
|
589
590
|
|
|
590
591
|
/**
|
|
@@ -695,18 +695,12 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
695
695
|
return this[prop].map((w) => {
|
|
696
696
|
const notification = notifications[w.notificationKey];
|
|
697
697
|
if (!notification) return w;
|
|
698
|
-
const {
|
|
699
|
-
actualStartTime: startTime,
|
|
700
|
-
actualEndTime: endTime,
|
|
701
|
-
actualBreakMinutes: breakMinutes,
|
|
702
|
-
actualIsStartNextDay: isStartNextDay,
|
|
703
|
-
} = notification;
|
|
704
698
|
return new SiteOperationScheduleDetail({
|
|
705
699
|
...w.toObject(),
|
|
706
|
-
startTime,
|
|
707
|
-
endTime,
|
|
708
|
-
breakMinutes,
|
|
709
|
-
isStartNextDay,
|
|
700
|
+
startTime: notification.actualStartTime,
|
|
701
|
+
endTime: notification.actualEndTime,
|
|
702
|
+
breakMinutes: notification.actualBreakMinutes,
|
|
703
|
+
isStartNextDay: notification.actualIsStartNextDay,
|
|
710
704
|
});
|
|
711
705
|
});
|
|
712
706
|
};
|
|
@@ -718,10 +712,10 @@ export default class SiteOperationSchedule extends Operation {
|
|
|
718
712
|
...this.toObject(),
|
|
719
713
|
employees,
|
|
720
714
|
outsourcers,
|
|
721
|
-
agreement: agreement || null,
|
|
715
|
+
// agreement: agreement || null,
|
|
722
716
|
siteOperationScheduleId: this.docId,
|
|
723
717
|
});
|
|
724
|
-
operationResult.refreshBillingDateAt();
|
|
718
|
+
// operationResult.refreshBillingDateAt();
|
|
725
719
|
await this.constructor.runTransaction(async (transaction) => {
|
|
726
720
|
const docRef = await operationResult.create({
|
|
727
721
|
docId: this.docId,
|