Skip to content

Commit 0cdabbf

Browse files
authored
Merge pull request #10847 from appwrite/feat-csv-export
Set downloadUrl on realtime event
2 parents 4616a2e + 2443266 commit 0cdabbf

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Appwrite/Platform/Workers/Migrations.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ function () use ($migration, $transfer, $project, $queueForRealtime) {
411411
$source?->success();
412412

413413
if ($migration->getAttribute('destination') === DestinationCSV::getName()) {
414-
$this->handleCSVExportComplete($project, $migration, $queueForMails);
414+
$this->handleCSVExportComplete($project, $migration, $queueForMails, $queueForRealtime);
415415
}
416416
}
417417
}
@@ -432,7 +432,8 @@ function () use ($migration, $transfer, $project, $queueForRealtime) {
432432
protected function handleCSVExportComplete(
433433
Document $project,
434434
Document $migration,
435-
Mail $queueForMails
435+
Mail $queueForMails,
436+
Realtime $queueForRealtime,
436437
): void {
437438
$options = $migration->getAttribute('options', []);
438439
$bucketId = 'default'; // Always use platform default bucket
@@ -530,6 +531,9 @@ protected function handleCSVExportComplete(
530531
$endpoint = System::getEnv('_APP_DOMAIN', '');
531532
$protocol = System::getEnv('_APP_OPTIONS_FORCE_HTTPS', 'disabled') === 'enabled' ? 'https' : 'http';
532533
$downloadUrl = "{$protocol}://{$endpoint}/v1/storage/buckets/{$bucketId}/files/{$fileId}/push?project={$project->getId()}&jwt={$jwt}";
534+
$options['downloadUrl'] = $downloadUrl;
535+
$migration->setAttribute('options', $options);
536+
$this->updateMigrationDocument($migration, $project, $queueForRealtime);
533537

534538
$this->sendCSVEmail(
535539
success: true,

0 commit comments

Comments
 (0)