-
Notifications
You must be signed in to change notification settings - Fork 20
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
Separate app by feature #687
Merged
dpgraham4401
merged 11 commits into
USEPA:main
from
dpgraham4401:separate_app_by_feature
Feb 20, 2024
Merged
Separate app by feature #687
dpgraham4401
merged 11 commits into
USEPA:main
from
dpgraham4401:separate_app_by_feature
Feb 20, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initial migrate manifest model (along with PortsOfEntry, CorrectionInfo, AdditionalInfo, etc.) to the manifest app.
remove wasteline information from the 'trak' app, including the data migrations that populates the database with initial DOT codes move test fixtures, and tests related to the waste line to our new 'wasteline' django app add urls to wasteline app add wasteline app models and views
…steline' or 'manifest' apps move remaining services, views and tests related to the manifest entity to the 'manifest' django app The one corollary to this is we moved many of the test fixtures to the django app root. Would like to move these back into the corresponding apps to keep things relatively isolated move manifest URLs and views to manifest app move the manifest model and related classes to the new django 'manifest' app
The handler app contains information about a waste handler, which is an instance of a RCRAinfo site on a manifest (e.g., signature info)
To clarify this feature is related to the RCRAInfo site, as opposed to the site app which will contain the haztrak site
move HaztrakOrg model to new 'org' django app move HaztrakOrg related views, services, and test to the new django 'org' app
scaffold new 'profile' django app which will house user profile information not related to authentication
…eign keys generally resolve back to the user model instead of pointing towards each other where applicable. This commit also takes the time to apply a more consistent naming convention to our Trak service (our monolithic backend Restful API) rename RcrainfoSitePermissions to RcrainfoSiteAccess for consistency update development fixtures consistent naming in Test... classes use consistent naming in services, serializers and views, and models rename SitePermission to TrakSiteAccess rename HaztrakSite to TrakSite rename HaztrakProfile to TrakProfile rename HaztrakOrg to TrakOrg rename HaztrakUser to TrakUser remove foreign key between RcraSite and RcrainfoSitePermissions this is a hold over from when a user could only interact with a resource in RCRAInfo if they had the site manager permissions for a site (and therefore an API ID and Key). This has changed since the Remote Signer Policy implement access through the TrakOrgPermissions model
…s, remove dead code (ImportInfo and CorrectionInfo) use settings.AUTH_USER_MODEL instead of explicitly using the core user model Add new settings including TRAK_RCRAINFO_SITE_MODEL, TRAK_SITE_MODEL, TRAK_HANDLER_MODEL, TRAK_ORG_MODEL, TRAK_MANIFEST_MODEL
…ay from our controllers and views and consolidating those queries in the model portion of our application. It's incomplete, and there is still more work to be done on this subject. This commit is squashed and contains a number of other things that it shouldn't such as adding an Organization details view, and a shell script function for running coverage reports. Apply consistent style/structure to the new wasteline app so each view calls a service module function that calls a query method on the appropriate model manager get_state_waste_codes service method New DotLookupBaseManager base class for all DotLookup manager with an additional 'filter_by_value' method applicable to all classes filter_by_state_id query method for state waste codes Add manager methods to TrakSite model manager and implement add coverage dependency and document process in the runhaz.sh shell script use manager method and chain with & operator to filter by user and EPA id number site filter by EPA id add filter_by_user method move test fixtures into smaller scope python modules (django apps) where applicable rename abstract factory methods use new TrakSite filter_by_username query method in manifest service get_by_user query method for the TrakSite model
github-actions
bot
added
database
changes that require modification to the database schema
dependencies
project dependency problems or modifications
documentation
Improvements or additions to documentation
server
Related to backend workings (Django/Rest API)
test
Unit tests are, or need to be, included
labels
Feb 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
database
changes that require modification to the database schema
dependencies
project dependency problems or modifications
documentation
Improvements or additions to documentation
server
Related to backend workings (Django/Rest API)
test
Unit tests are, or need to be, included
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR is part of series of TLC PRs i intend to submit for the backend. Namely this PR does 1 major thing and that is separates the organization of our backend by feature, instead of just clumping all the source into just a few modules.
Now, when we navigate to the
server/apps/
directory there are a list of django apps that each coorrespond to a feature of the haztrak application. This makes the layout and organization of the overall django project easier to understand, as well as the scope of each django app. These apps have limited scope in terms of the models/entities/DB tables they implement, as well as the services, views, tests, and configs that accompany them. I'm really happy with the way this is going, and there is a lot more work to do on this subject.In addition, I also started but havne't finished, abstracting our model queries into django's model managers. This way we'll keep our views and controllers ignorent of the structure of our database tables.
It's a little embarressing we are doing this now and not at the beggining of the project but Haztrak has always been a learn by doing project. Now we know better.
Issue ticket number and link
Checklist