Implement compliance exports and retention overrides
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Enums\DataExportScope;
|
||||
use App\Jobs\GenerateDataExport;
|
||||
use App\Models\DataExport;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
@@ -17,6 +18,7 @@ class ProfileDataExportController extends Controller
|
||||
abort_unless($user, 403);
|
||||
|
||||
$hasRecentExport = $user->dataExports()
|
||||
->where('scope', DataExportScope::USER->value)
|
||||
->whereIn('status', [DataExport::STATUS_PENDING, DataExport::STATUS_PROCESSING])
|
||||
->exists();
|
||||
|
||||
@@ -25,6 +27,7 @@ class ProfileDataExportController extends Controller
|
||||
}
|
||||
|
||||
$recentReadyExport = $user->dataExports()
|
||||
->where('scope', DataExportScope::USER->value)
|
||||
->where('status', DataExport::STATUS_READY)
|
||||
->where('created_at', '>=', now()->subDay())
|
||||
->exists();
|
||||
@@ -36,6 +39,8 @@ class ProfileDataExportController extends Controller
|
||||
$export = $user->dataExports()->create([
|
||||
'tenant_id' => $user->tenant_id,
|
||||
'status' => DataExport::STATUS_PENDING,
|
||||
'scope' => DataExportScope::USER->value,
|
||||
'include_media' => false,
|
||||
]);
|
||||
|
||||
GenerateDataExport::dispatch($export->id);
|
||||
|
||||
Reference in New Issue
Block a user