fix: handover/handback lifecycle hook

This commit is contained in:
Mohamed Marrouchi 2025-02-04 17:57:37 +01:00
parent 1288eb87cf
commit 21301b9702

View File

@ -80,6 +80,8 @@ export class SubscriberRepository extends BaseRepository<
): Promise<void> { ): Promise<void> {
const subscriberUpdates: SubscriberUpdateDto = updates?.['$set']; const subscriberUpdates: SubscriberUpdateDto = updates?.['$set'];
if ('assignedTo' in subscriberUpdates) {
// In case of a handover or handback, emit events
const oldSubscriber = await this.findOne(criteria); const oldSubscriber = await this.findOne(criteria);
if (!oldSubscriber) { if (!oldSubscriber) {
@ -103,6 +105,7 @@ export class SubscriberRepository extends BaseRepository<
} }
} }
} }
}
/** /**
* Constructs a query to find a subscriber by their foreign ID. * Constructs a query to find a subscriber by their foreign ID.