mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-30 03:03:03 +00:00
upd: send email on export completion
This commit is contained in:
parent
e9b6ed941b
commit
fabb876256
1 changed files with 9 additions and 0 deletions
|
@ -21,6 +21,7 @@ import { UtilityService } from '@/core/UtilityService.js';
|
||||||
import { DownloadService } from '@/core/DownloadService.js';
|
import { DownloadService } from '@/core/DownloadService.js';
|
||||||
import { QueueLoggerService } from '../QueueLoggerService.js';
|
import { QueueLoggerService } from '../QueueLoggerService.js';
|
||||||
import type * as Bull from 'bullmq';
|
import type * as Bull from 'bullmq';
|
||||||
|
import { EmailService } from '@/core/EmailService.js';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ExportAccountDataProcessorService {
|
export class ExportAccountDataProcessorService {
|
||||||
|
@ -71,6 +72,7 @@ export class ExportAccountDataProcessorService {
|
||||||
private idService: IdService,
|
private idService: IdService,
|
||||||
private driveFileEntityService: DriveFileEntityService,
|
private driveFileEntityService: DriveFileEntityService,
|
||||||
private downloadService: DownloadService,
|
private downloadService: DownloadService,
|
||||||
|
private emailService: EmailService,
|
||||||
private queueLoggerService: QueueLoggerService,
|
private queueLoggerService: QueueLoggerService,
|
||||||
) {
|
) {
|
||||||
this.logger = this.queueLoggerService.logger.createSubLogger('export-account-data');
|
this.logger = this.queueLoggerService.logger.createSubLogger('export-account-data');
|
||||||
|
@ -709,6 +711,13 @@ export class ExportAccountDataProcessorService {
|
||||||
this.logger.succ(`Exported to: ${driveFile.id}`);
|
this.logger.succ(`Exported to: ${driveFile.id}`);
|
||||||
cleanup();
|
cleanup();
|
||||||
archiveCleanup();
|
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();
|
resolve();
|
||||||
});
|
});
|
||||||
archive.pipe(archiveStream);
|
archive.pipe(archiveStream);
|
||||||
|
|
Loading…
Reference in a new issue