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

feat(export invoices): Create data export #2226

Merged
merged 11 commits into from
Jul 2, 2024

Conversation

ancorcruz
Copy link
Contributor

@ancorcruz ancorcruz commented Jun 27, 2024

Roadmap Task

👉 https://getlago.canny.io/feature-requests/p/ability-to-export-data-from-the-user-interface

Context

In order to effortlessly download export of invoices by non-technical users, it is required to extend the invoices filtering capabilities.

Description

This change modifies the data_exports database table adding references to memberships and organizations (drops reference to users) to ensure we can identify the user that initiates the export request but also the organization we are exporting the data from.

Also, this introduces the mailer to notify the user the export is ready, a service to create to create the data export record and queue the job to process the export, and enables action mailer previews to try emails in local in a more convenient way opening the email in the url: https://api.lago.dev/rails/mailers/data_export_mailer/completed.html?locale=en

Monosnap Mailer Preview for data_export_mailer#completed 2024-07-01 09-16-29

@ancorcruz ancorcruz added Feature Add a new feature to the app Export user export capabilities labels Jun 27, 2024
@ancorcruz ancorcruz self-assigned this Jun 27, 2024
@ancorcruz ancorcruz force-pushed the feat-export-invoices-create-data-export branch 2 times, most recently from db30956 to 03f1d93 Compare July 1, 2024 08:05
@ancorcruz ancorcruz marked this pull request as ready for review July 1, 2024 08:17
receives user, format, resource_type and resource_query, creates a
new record and queues a job to produce the export file
this job calls the ExportResourcesService
remove relationship with user to ensure we have access to all the
required data (organization, membership and user through membership)
also, ensure preview does not clutter the development database
file_url creates a link with expiration time

filename is based in the creation date, resource type and format of the
export
@ancorcruz ancorcruz force-pushed the feat-export-invoices-create-data-export branch from 161fc43 to 0f4de55 Compare July 1, 2024 17:18
@ancorcruz ancorcruz merged commit 1f8eab1 into main Jul 2, 2024
6 checks passed
@ancorcruz ancorcruz deleted the feat-export-invoices-create-data-export branch July 2, 2024 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Export user export capabilities Feature Add a new feature to the app
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants