From 03ccdef1c3fa307be94c2ee5bf2b5a584b2f38a6 Mon Sep 17 00:00:00 2001 From: Morgan Ludtke Date: Tue, 7 Nov 2023 14:35:16 -0600 Subject: [PATCH] fix: link and unit fix --- backend/core/src/email/email.service.ts | 2 +- backend/core/src/listings/listings.service.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/backend/core/src/email/email.service.ts b/backend/core/src/email/email.service.ts index 35e1a78888..8593e649d7 100644 --- a/backend/core/src/email/email.service.ts +++ b/backend/core/src/email/email.service.ts @@ -350,7 +350,7 @@ export class EmailService { const compiled = compiledTemplate({ listingName: listing.name, - listingUrl: jurisdiction.publicUrl, + listingUrl: `${jurisdiction.publicUrl}/listings/${listing.id}`, tableRows, }) diff --git a/backend/core/src/listings/listings.service.ts b/backend/core/src/listings/listings.service.ts index cac56e8a4a..d1343f632f 100644 --- a/backend/core/src/listings/listings.service.ts +++ b/backend/core/src/listings/listings.service.ts @@ -254,7 +254,16 @@ export class ListingsService { previousStatus !== ListingStatus.active && jurisdiction.enableListingOpportunity ) { - await this.emailService.listingOpportunity(saveResponse) + // The email send to gov delivery should not be a blocker from the normal flow so wrapping this in a try catch + try { + const units = await this.getUnitsForListing(saveResponse.id) + await this.emailService.listingOpportunity({ + ...saveResponse, + units: units.units, + } as Listing) + } catch (error) { + console.error(`Error: unable to send to govDelivery ${error}`) + } } return saveResponse }