Skip to content

Commit

Permalink
fix: now removes criteria file if a url is input (#3421)
Browse files Browse the repository at this point in the history
  • Loading branch information
YazeedLoonat committed May 3, 2023
1 parent 7cf1a89 commit d50f469
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions backend/core/src/listings/listings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,18 @@ export class ListingsService {
await this.afsService.scheduleAfsProcessing()
}

if (listingDto.buildingSelectionCriteria) {
listing.buildingSelectionCriteriaFile = null
await this.listingRepository.update(
{ id: listing.id },
{
buildingSelectionCriteriaFile: null,
}
)
} else if (listingDto.buildingSelectionCriteriaFile) {
listing.buildingSelectionCriteria = null
}

Object.assign(listing, {
...listingDto,
publishedAt:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const LotteryResults = () => {

const saveURL = (url) => {
setValue("buildingSelectionCriteria", url)
deletePDF()
}
const deleteURL = () => {
setValue("buildingSelectionCriteria", "")
Expand All @@ -58,6 +59,7 @@ const LotteryResults = () => {
fileId: cloudinaryData.id,
label: "cloudinaryPDF",
})
deleteURL()
}
const deletePDF = () => {
setValue("buildingSelectionCriteriaFile", { fileId: "", label: "" })
Expand Down

0 comments on commit d50f469

Please sign in to comment.