Skip to content

Commit ed3fd6b

Browse files
authored
Merge pull request #522 from AppQuality/update-delete-attachment-logic
feat: update attachment deletion logic to ensure database records are…
2 parents 59a75b3 + 415c9aa commit ed3fd6b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • src/routes/campaigns/campaignId/finance/otherCosts/_delete

src/routes/campaigns/campaignId/finance/otherCosts/_delete/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ export default class OtherCostsDeleteRoute extends CampaignRoute<{
6363
for (const attachment of attachments) {
6464
try {
6565
await deleteFromS3({ url: attachment.url });
66+
await tryber.tables.WpAppqCampaignOtherCostsAttachment.do()
67+
.where({ id: attachment.id })
68+
.delete();
6669
} catch (e) {
6770
console.error(
6871
`Error deleting attachment from S3: ${attachment.url}`,
6972
e
7073
);
7174
throw new Error("Error deleting attachment from S3");
7275
}
73-
await tryber.tables.WpAppqCampaignOtherCostsAttachment.do()
74-
.where({ id: attachment.id })
75-
.delete();
7676
}
7777
}
7878

0 commit comments

Comments
 (0)