-
Notifications
You must be signed in to change notification settings - Fork 56
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
add attachment_id to metadata #16726
Conversation
Pull request was converted to draft
filler = IvcChampva::PdfFiller.new(form_number: form_id, form:) | ||
attachment_ids = [form_id] | ||
|
||
if form_id == 'vha_10_10d' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only going to work for 10-10D? Shouldn't we write this to work for any form? If it's form specific this logic should go in the model it's specific to i.e. models/ivc_champva/vha_10_10d.rb
and not in the controller. If it's logic that can be used across all of them it can go in the service module Attachments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If your form wants to use this logic, you will have to modify the data structure for your form
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to change the data structure of your form to : "applicants"=> and "applicant_supporting_documents"=>
if you want to apply this method.
end | ||
|
||
def get_form_id | ||
form_number = params[:form_number] | ||
raise 'missing form_number in params' unless form_number | ||
|
||
FORM_NUMBER_MAP[form_number] | ||
form_number_without_colon = form_number.sub(':', '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain why we have to add this? The form map key/value above doesn't have colons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For 1010D it does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? The map is '10-10D' => 'vha_10_10d',
when does the colon come into play?
@form_id = form_id | ||
@metadata = metadata || {} | ||
@file_paths = Array(file_paths) | ||
@attachment_ids = attachment_ids |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why couldn't we include this in the metadata itself? Why does it have to be a new argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some forms don't require attachments
metadata&.transform_values! { |value| value || '' } | ||
metadata['attachment_ids'] = attachment_ids.empty? ? '' : attachment_ids.join(',') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could happen much sooner, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Not all forms
Summary
This PR adds attachment_id to the S3 PutObject metadata for DOCMP PEGA S3 Bucket. Each attachment will now have a corresponding "attachment_id" in their metadata. (see attached). If you visit the s3 admin console, you will see it as the supporting documents = "x-amz-meta-attachment-ids"
Testing done
Screenshots
What areas of the site does it impact?
It will only impact the DOCMP PEGA owned S3 buckets called
Box-stage
Box-prod
Box-dev
Acceptance criteria