Skip to content

Commit

Permalink
fix subscriber
Browse files Browse the repository at this point in the history
  • Loading branch information
c1495616js committed Jan 17, 2025
1 parent 7c06aef commit 573886c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/api/src/applicant/entity/ienapplicant.subscriber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export class IENApplicantSubscriber implements EntitySubscriberInterface<IENAppl
const { entity, manager } = event;

// If there's no entity or the entity has no ats1_id do nothing
if (!entity || !entity.ats1_id) return;
if (!entity?.ats1_id) return;

// Retrieve the original entity from the database
const databaseEntity = await manager.findOne(IENApplicant, { ats1_id: entity.ats1_id });

// If the original entity is found and it's marked as deleted,, revert the changes for the specified fields
if (databaseEntity && databaseEntity.deleted_date) {
if (databaseEntity?.deleted_date) {
entity.name = databaseEntity.name;
entity.email_address = databaseEntity.email_address;
entity.phone_number = databaseEntity.phone_number;
Expand Down

0 comments on commit 573886c

Please sign in to comment.