diff options
| author | Mar0xy <marie@kaifa.ch> | 2023-11-07 11:31:11 +0100 |
|---|---|---|
| committer | Mar0xy <marie@kaifa.ch> | 2023-11-07 11:31:11 +0100 |
| commit | fabb8762567b61367cfa535130f3b635a62d425d (patch) | |
| tree | 1fe20c4c440d7cee08dc6a40b3e8e9d2ad70b9f9 /packages/backend/src/queue/processors | |
| parent | add: endpoint and processor for account data export (diff) | |
| download | sharkey-fabb8762567b61367cfa535130f3b635a62d425d.tar.gz sharkey-fabb8762567b61367cfa535130f3b635a62d425d.tar.bz2 sharkey-fabb8762567b61367cfa535130f3b635a62d425d.zip | |
upd: send email on export completion
Diffstat (limited to 'packages/backend/src/queue/processors')
| -rw-r--r-- | packages/backend/src/queue/processors/ExportAccountDataProcessorService.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/backend/src/queue/processors/ExportAccountDataProcessorService.ts b/packages/backend/src/queue/processors/ExportAccountDataProcessorService.ts index f85f757fa1..97902f8582 100644 --- a/packages/backend/src/queue/processors/ExportAccountDataProcessorService.ts +++ b/packages/backend/src/queue/processors/ExportAccountDataProcessorService.ts @@ -21,6 +21,7 @@ import { UtilityService } from '@/core/UtilityService.js'; import { DownloadService } from '@/core/DownloadService.js'; import { QueueLoggerService } from '../QueueLoggerService.js'; import type * as Bull from 'bullmq'; +import { EmailService } from '@/core/EmailService.js'; @Injectable() export class ExportAccountDataProcessorService { @@ -71,6 +72,7 @@ export class ExportAccountDataProcessorService { private idService: IdService, private driveFileEntityService: DriveFileEntityService, private downloadService: DownloadService, + private emailService: EmailService, private queueLoggerService: QueueLoggerService, ) { this.logger = this.queueLoggerService.logger.createSubLogger('export-account-data'); @@ -709,6 +711,13 @@ export class ExportAccountDataProcessorService { this.logger.succ(`Exported to: ${driveFile.id}`); cleanup(); archiveCleanup(); + if (profile.email) { + this.emailService.sendEmail(profile.email, + 'Your data archive is ready', + `Click the following link to download the archive: ${driveFile.url}<br/>It is also available in your drive.`, + `Click the following link to download the archive: ${driveFile.url}\r\n\r\nIt is also available in your drive.`, + ); + } resolve(); }); archive.pipe(archiveStream); |