Add endpoint to redirect from contact list to send

In order to use a contact list we’re going to put you in the normal
upload a spreadsheet journey. Except without having to upload again.

So this commit adds an endpoint that takes the file from the contact
list bucket, puts it in the same place it would have gone if you’d
uploaded it, then sends you on your way.
This commit is contained in:
Chris Hill-Scott
2020-03-13 14:38:43 +00:00
parent 03f2368deb
commit 460b779d11
4 changed files with 76 additions and 0 deletions

View File

@@ -51,6 +51,22 @@ class ContactList(JSONModel):
bucket=ContactList.get_bucket_name(),
)
@staticmethod
def copy_to_uploads(service_id, upload_id):
contents = ContactList.download(service_id, upload_id)
metadata = ContactList.get_metadata(service_id, upload_id)
new_upload_id = s3upload(
service_id,
contents,
current_app.config['AWS_REGION'],
)
set_metadata_on_csv_upload(
service_id,
new_upload_id,
**metadata,
)
return new_upload_id
@classmethod
def create(cls, service_id, upload_id):