refactor(databases): update backup queries to use team-specific method

- Modified backup retrieval logic in DatabasesController to utilize the new ownedByCurrentTeamAPI method for improved access control based on team ID.
- Enhanced code consistency and maintainability by centralizing team-based filtering in the ScheduledDatabaseBackup model.
This commit is contained in:
Andras Bacsai
2025-09-22 17:47:46 +02:00
parent bb06a74fee
commit 33d25f418e
2 changed files with 11 additions and 6 deletions

View File

@@ -15,6 +15,11 @@ class ScheduledDatabaseBackup extends BaseModel
return ScheduledDatabaseBackup::whereRelation('team', 'id', currentTeam()->id)->orderBy('name');
}
public static function ownedByCurrentTeamAPI(int $teamId)
{
return ScheduledDatabaseBackup::whereRelation('team', 'id', $teamId)->orderBy('name');
}
public function team()
{
return $this->belongsTo(Team::class);