refactor backup download
This commit is contained in:
parent
360f5db2cf
commit
6bb05a6780
@ -247,10 +247,16 @@
|
||||
Route::get('/download/backup/{executionId}', function () {
|
||||
try {
|
||||
$team = auth()->user()->currentTeam();
|
||||
if (is_null($team)) {
|
||||
return response()->json(['message' => 'Team not found.'], 404);
|
||||
}
|
||||
$exeuctionId = request()->route('executionId');
|
||||
$execution = ScheduledDatabaseBackupExecution::where('id', $exeuctionId)->firstOrFail();
|
||||
// // get team
|
||||
if ($team->id !== $execution->scheduledDatabaseBackup->database->team()->id) {
|
||||
$execution_team_id = $execution->scheduledDatabaseBackup->database->team()?->id;
|
||||
if (is_null($execution_team_id)) {
|
||||
return response()->json(['message' => 'Team not found.'], 404);
|
||||
}
|
||||
if ($team->id !== $execution_team_id) {
|
||||
return response()->json(['message' => 'Permission denied.'], 403);
|
||||
}
|
||||
if (is_null($execution)) {
|
||||
|
Loading…
Reference in New Issue
Block a user