Add "data export" feature

- Adds a button in Account Settings where you can request a ZIP export of your
  Fizzy data
- Export files are created in the background. When ready, a link to
  download them is sent to the requester.
- Exports expire after 24 hours. And are limited to 10 per day.
This commit is contained in:
Kevin McConnell
2025-12-01 10:10:51 +00:00
parent 6fb7de88d7
commit e16cc21b0a
28 changed files with 565 additions and 3 deletions
+16
View File
@@ -0,0 +1,16 @@
require "test_helper"
class ExportMailerTest < ActionMailer::TestCase
test "completed" do
export = Account::Export.create!(account: Current.account, user: users(:david))
email = ExportMailer.completed(export)
assert_emails 1 do
email.deliver_now
end
assert_equal [ "david@37signals.com" ], email.to
assert_equal "Your Fizzy export is ready", email.subject
assert_match %r{/exports/#{export.id}}, email.body.encoded
end
end
@@ -0,0 +1,11 @@
class ExportMailerPreview < ActionMailer::Preview
def completed
export = Account::Export.new(
id: "preview-export-id",
account: Account.first,
user: User.first
)
ExportMailer.completed(export)
end
end