(fix): inject dbForProject into getDatabasesDB for related collection lookups

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jake Barnby
2026-04-02 03:14:15 +13:00
co-authored by Claude Opus 4.6
parent 95552031ef
commit 61a623fcc0
+3 -3
View File
@@ -707,9 +707,9 @@ Http::setResource('dbForPlatform', function (Group $pools, Cache $cache, Authori
return $database;
}, ['pools', 'cache', 'authorization']);
Http::setResource('getDatabasesDB', function (Group $pools, Cache $cache, Document $project, Request $request, UsageContext $usage, Authorization $authorization) {
Http::setResource('getDatabasesDB', function (Group $pools, Database $dbForProject, Cache $cache, Document $project, Request $request, UsageContext $usage, Authorization $authorization) {
return function (Document $database, ?Document $collection = null) use ($pools, $cache, $project, $request, $usage, $authorization): Database {
return function (Document $database, ?Document $collection = null) use ($pools, $dbForProject, $cache, $project, $request, $usage, $authorization): Database {
$originalDatabase = $database;
$context = str_contains($request->getURI(), '/tablesdb/') ? 'table' : 'collection';
$databaseDSN = $database->getAttribute('database', $project->getAttribute('database', ''));
@@ -830,7 +830,7 @@ Http::setResource('getDatabasesDB', function (Group $pools, Cache $cache, Docume
return $database;
};
}, ['pools','cache','project','request','usage','authorization']);
}, ['pools','dbForProject','cache','project','request','usage','authorization']);
Http::setResource('getProjectDB', function (Group $pools, Database $dbForPlatform, $cache, Authorization $authorization) {
$databases = [];