Feat/military affiliation records#363
Conversation
We need to support the storage of military affiliation records for providers that are in the military. This new S3 bucket will be a general purpose bucket for provider user documents.
we need to track this to display if the user is a member of the military or is a military member's spouse.
We may need to support this in the future.
This is more secure, and actually easier for the front end client to work with.
To deal with potential future timezone headaches, we need to be capturing the full timezone for the date the record was uploaded.
This updates the status for any military affiliation to inactive. As part of this implementation, fixed post logic to set previous records to inactive when a new record is uploaded.
This lambda will process all object uploads in the provider user s3 bucket. For now, it only processes military affiliation records by setting their status to active.
The linter can't handle this for some reason, so we'll have to hardcode the string value :(
Thinking forward to supporting multiple file uploads at once: This will make it easier for the front end client to determine which file to associate with the S3 pre-sign url.
These tests can be run locally against a sandbox environment to verify that the military affiliation records can be uploaded to s3 as expected and the status of the records can be updated using the PATCH endpoint. This also includes the fixes found by those tests.
Instead of referring to the license record to determine if a provider has an active military affiliation, we now check the list of military affiliation records associated with the provider.
013922c to
79481dc
Compare
|
@jlkravitz - Given that @jusdino is out for the week, I'm putting this up for CSG review. Feel free to postpone on this review if you would prefer to wait until @jusdino gets back. Thanks. |
|
Happy to take a pass now. I assume @jusdino will review when he's back?
|
jlkravitz
left a comment
There was a problem hiding this comment.
Generally looks great! A few comments/questions. Thanks for documenting the changes thoroughly- made it easy to follow.
backend/compact-connect/lambdas/common-python/cc_common/data_model/client.py
Outdated
Show resolved
Hide resolved
backend/compact-connect/lambdas/common-python/cc_common/data_model/client.py
Outdated
Show resolved
Hide resolved
backend/compact-connect/lambdas/common-python/cc_common/data_model/schema/common.py
Outdated
Show resolved
Hide resolved
...nd/compact-connect/lambdas/common-python/cc_common/data_model/schema/military_affiliation.py
Outdated
Show resolved
Hide resolved
backend/compact-connect/lambdas/provider-data-v1/handlers/provider_s3_events.py
Show resolved
Hide resolved
...ect/lambdas/provider-data-v1/tests/function/test_data_model/test_provider_transformations.py
Outdated
Show resolved
Hide resolved
backend/compact-connect/lambdas/common-python/tests/unit/test_data_model/test_data_client.py
Show resolved
Hide resolved
backend/compact-connect/tests/smoke/military_affiliation_smoke_tests.py
Outdated
Show resolved
Hide resolved
backend/compact-connect/tests/smoke/military_affiliation_smoke_tests.py
Outdated
Show resolved
Hide resolved
backend/compact-connect/tests/smoke/military_affiliation_smoke_tests.py
Outdated
Show resolved
Hide resolved
|
@jlkravitz Once this is approved, we could have @jusdino do a post-merge review when he gets back next week so this branch doesn't become stale, or we could wait to merge until he performs a review. I'll leave that up to your call. |
jlkravitz
left a comment
There was a problem hiding this comment.
@isabeleliassen Good to merge. @jusdino has not reviewed this PR since he is OOO, but per @landonshumway-ia's comment, I think it makes most sense to merge this now and have @jusdino do a post-merge review.
We need to support licensees uploading documentation as evidence for their military affiliation. We will be recording the military affiliation upload history as records in the provider DynamoDB table which will be used by the system to determine a user's current military affiliation status. As part of this, we've added a new POST endpoint which allows the user to specify a filename. When called, the API generates a S3 pre-sign URL (active for 10 minutes) which the front end will then use to upload that file into S3 directly. Once the file is successfully uploaded, S3 will trigger a lambda function to complete the initialization of the military affiliation record for that provider so they will be eligible for any military discounts when purchasing privileges.
When a user wants to end their military affiliation, the client will call a PATCH endpoint that will set their military status to inactive.
Requirements List
Description List
Testing List
yarn test:unit:allshould run without errors or warningsyarn serveshould run without errors or warningsyarn buildshould run without errors or warningsbackend/compact-connect/tests/unit/test_api.pyCloses #327