Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle opportunity attachments when opportunity changes is_draft or is deleted #3500

Closed
2 tasks
chouinar opened this issue Jan 13, 2025 · 0 comments
Closed
2 tasks
Assignees

Comments

@chouinar
Copy link
Collaborator

Summary

Summary

In #3322 we setup the opportunity attachment transformations when processing the attachments themselves, but need to also account for when the opportunity itself is updated (the below two scenarios).

Opportunity Update

If is_draft on an opportunity changes from True to False, we want to move all of the attachments to the public bucket. As opportunities get processed before attachments, we may move something and then later do another update, that is perfectly fine.

Opportunity delete

When we delete an ORM object, we automatically handle recursively deleting all the related models, but that wouldn’t cascade into s3. If an opportunity needs to be deleted, we want to first delete all of its attachments from s3, and then delete the opportunity.

Acceptance criteria

  • Logic updated
  • Tests added
@chouinar chouinar moved this from Icebox to Todo in Simpler.Grants.gov Product Backlog Jan 13, 2025
@chouinar chouinar self-assigned this Jan 13, 2025
@chouinar chouinar moved this from Todo to In Progress in Simpler.Grants.gov Product Backlog Jan 13, 2025
@chouinar chouinar moved this from In Progress to In Review in Simpler.Grants.gov Product Backlog Jan 13, 2025
chouinar added a commit that referenced this issue Jan 16, 2025
…ublished (#3503)

## Summary
Fixes #3500

### Time to review: __10 mins__

## Changes proposed
Handle the following two cases during the transformation process
* Opportunity deleted - clean up attachments from s3
* Opportunity stops being a draft - move all the attachments to the
other s3 bucket

## Context for reviewers
Mostly just some additional file utils for moving files to handle the
above scenarios. Only noteworthy callout is that there isn't really a
concept of "moving" a file on s3, it's just a copy+delete.
@chouinar chouinar moved this from In Review to Done in Simpler.Grants.gov Product Backlog Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant