Skip to content

Commit

Permalink
fix: no notification case
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinBuyck committed Aug 26, 2023
1 parent a7803f3 commit f89c69f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions backend/core/src/listings/listings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ export class ListingsService {
}

async updateAndNotify(listingData: ListingUpdateDto) {
const result = await this.update(listingData)

let result
if (listingData.status === ListingStatus.pendingReview) {
result = await this.update(listingData)
const approvingUserEmails = await this.getApprovingUserEmails()
await this.emailService.requestApproval(
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
Expand All @@ -282,6 +282,7 @@ export class ListingsService {
this.configService.get("PARTNERS_PORTAL_URL")
)
} else if (listingData.status === ListingStatus.changesRequested) {
result = await this.update(listingData)
const nonApprovingUserInfo = await this.getNonApprovingUserInfo(
listingData.id,
listingData.jurisdiction.id
Expand All @@ -299,13 +300,14 @@ export class ListingsService {
.select("listings.status")
.where("id = :id", { id: listingData.id })
.getOne()

result = await this.update(listingData)
console.log(previousStatus)
if (
previousStatus.status !== ListingStatus.pendingReview &&
previousStatus.status !== ListingStatus.changesRequested
)
) {
return result

}
const nonApprovingUserInfo = await this.getNonApprovingUserInfo(
listingData.id,
listingData.jurisdiction.id,
Expand All @@ -318,6 +320,8 @@ export class ListingsService {
nonApprovingUserInfo.emails,
nonApprovingUserInfo.publicUrl
)
} else {
result = await this.update(listingData)
}
return result
}
Expand Down

0 comments on commit f89c69f

Please sign in to comment.