Skip to content
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

FFE - Front-end and web-server changes #3908

Open
as1729 opened this issue Jan 21, 2025 · 1 comment
Open

FFE - Front-end and web-server changes #3908

as1729 opened this issue Jan 21, 2025 · 1 comment

Comments

@as1729
Copy link
Contributor

as1729 commented Jan 21, 2025

Story: #3803

Requirements

  • Add a button to the front-end that allows users to kick-off Full File export
  • Add a route on the backend that handles adding values to an SQS queue.
  • Add a route on the backend that handles getting a signed-URL for the full-file export .zip file from S3.

Front-end changes

  • Add a button that is only visible if isAdmin is true and enableFullFileExport feature flag is true in the HomeView.vue file. The button text should say “Send Full File Export by Email”.
  • The front-end should create a GET request to /api/uploads/exportAll
  • If the response is a 200 then show an alert: “Sent. Please note, it could take up to 1 hour for this email to arrive.”
  • Else if the response is not a 200 then show an alert: Display: “Something went wrong. Unable to send an email containing the treasury report. Reach out to [email protected] if this happens again.”
  • Reference code: https://github.com/usdigitalresponse/usdr-gost/blob/main/packages/client/src/arpa_reporter/views/HomeView.vue#L44-L57

Back-end webserver changes

  • Goal: There are two backend endpoints available to support users.
    • When the user clicks the button on the front-end there has to be an endpoint in the backend to support kicking off a SQS task.
    • When the SQS task is completed, it will kick-off an email which contains a second button for the user to retrieve their zip-file. This endpoint on the backend is responsible for generating an S3 signedUrl and giving that to the front-end to begin file-download.
      These endpoints will be defined in arpa_reporter/routes/uploads.js: https://github.com/usdigitalresponse/usdr-gost/blob/main/packages/server/src/arpa_reporter/routes/uploads.js

Endpoint 1 to add

Endpoint 2 to add

  • GET /api/uploads/:tenantId/getFullFileExport
    This endpoint is what will be emailed to users once the final zip-file is ready and uploaded to S3. When users click on the endpoint (assuming they are authenticated), their browser should immediately make a signed request to S3 and download the zip-file as well as the latest metadata CSV file.
    S3 bucket is: process.env.AUDIT_REPORT_BUCKET
    S3 Keys are:
    • fullFileExport/${user.tenant_id}/archive.zip
    • fullFileExport/${user.tenant_id}/archive_metadata.csv
    • Note: when downloading the zipfile and the metadata please use the ResponseContentDisposition and ensure that the names are updated to FullFileExport-MM.DD.YYY.HH.SS.zip and MetadataFullFileExport-MM.DD.YYYY.HH.SS.zip in 24 hr time format. The time is the time as of when the user visited this link.

This endpoint will model similarly to the endpoint defined here: https://github.com/usdigitalresponse/usdr-gost/blob/main/packages/server/src/arpa_reporter/routes/exports.js#L14-L48

@as1729
Copy link
Contributor Author

as1729 commented Feb 13, 2025

Discussed a few things:

The date for the archive and metadata file will use the head-object last updated information. Uses the CSV's headobject information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 In progress
Development

No branches or pull requests

2 participants