Skip to content

Enable PSF staff to force a required image from a sponsorship via benefit configuration #1900

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

Merged
merged 22 commits into from
Nov 8, 2021

Conversation

berinhard
Copy link
Contributor

@berinhard berinhard commented Oct 22, 2021

!!! THIS IS WIP !!!

This PR has a few commits from #1897, but once it gets merged, only the commits to address the custom assets will be displayed.

I'm opening this PR to get feedbacks from @ewdurbin on the DB modeling. Here's how I though about how to support generic assets under the sponsorship app:

  1. Define a pair of benefit feature/configuration models so admin users can configure the benefits;
  2. Every feature/configuration must define an unique internal_name and a related_to choice field (sponsors / sponsorship). Both fields will be controlled to know to which object the asset should relate to and also to query over Generic FKs using the internal_name to check if the sponsor and/or sponsorship has the required asset;
  3. The dashboard can iterate over all of the sponsorship's benefits and check the ones which require assets. Then, we'll use the internal_name and related_to object to fetch for the stored data in our DB via a more generic model;

I was thinking on following a very similar strategy with the documents assets (docx, pdf, ppts etc). We could define a new RequiredDocumentAsset configuration/benefit following the same strategy and using a new GenericFileAsset class to store the uploaded document.

@berinhard berinhard requested a review from ewdurbin October 22, 2021 14:32
Copy link
Member

@ewdurbin ewdurbin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modeling looks sound, assuming that the actual relations to Sponsor/Sponsorship objects will be handled in views/controllers.

@berinhard berinhard force-pushed the feature/generic-assets branch from 898f30a to 1723de4 Compare October 26, 2021 14:24
@berinhard berinhard force-pushed the feature/generic-assets branch from 1723de4 to 129d2ed Compare October 26, 2021 14:27
@berinhard berinhard force-pushed the feature/generic-assets branch from 64cde46 to 30a8672 Compare November 1, 2021 14:27
@berinhard berinhard marked this pull request as ready for review November 2, 2021 14:44
@berinhard berinhard requested a review from ewdurbin November 2, 2021 14:44
@ewdurbin ewdurbin merged commit 1064bf1 into main Nov 8, 2021
@ewdurbin ewdurbin deleted the feature/generic-assets branch November 8, 2021 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants