Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Finish DBAL migration (CO-2235), rename TierApiController to TapApiCo…
…ntroller (CO-2470)
Benn Oshrin committed Nov 27, 2022
1 parent b5c9bab commit d1cf34d
Showing 456 changed files with 8,659 additions and 66,459 deletions.
1 change: 0 additions & 1 deletion app/composer.json
@@ -6,7 +6,6 @@
"license": "MIT",
"require": {
"php": ">=7.3",
"adodb/adodb-php": "^5.21",
"cakephp/cakephp": "^4.3",
"cakephp/migrations": "^3.2",
"cakephp/plugin-installer": "^1.3",
145 changes: 54 additions & 91 deletions app/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions app/config/routes.php
@@ -58,21 +58,21 @@
$builder->connect('/pages/*', 'Pages::display');

/**
* TIER ID Match API Routes
* TAP ID Match API Routes
*/

// Match Request
$builder->get('/api/{matchgrid_id}/v1/matchRequests/{id}', ['controller' => 'TierApi', 'action' => 'viewMatchRequest']);
$builder->get('/api/{matchgrid_id}/v1/matchRequests', ['controller' => 'TierApi', 'action' => 'viewMatchRequests']);
$builder->put('/api/{matchgrid_id}/v1/people/{sor}/{sorid}', ['controller' => 'TierApi', 'action' => 'match']);
$builder->post('/api/{matchgrid_id}/v1/people/{sor}/{sorid}', ['controller' => 'TierApi', 'action' => 'search']);
$builder->get('/api/{matchgrid_id}/v1/matchRequests/{id}', ['controller' => 'TapApi', 'action' => 'viewMatchRequest']);
$builder->get('/api/{matchgrid_id}/v1/matchRequests', ['controller' => 'TapApi', 'action' => 'viewMatchRequests']);
$builder->put('/api/{matchgrid_id}/v1/people/{sor}/{sorid}', ['controller' => 'TapApi', 'action' => 'match']);
$builder->post('/api/{matchgrid_id}/v1/people/{sor}/{sorid}', ['controller' => 'TapApi', 'action' => 'search']);
// This doesn't match and we end up in current(), so we just check there
// Also, as of API v1.0.0, search over GET has been removed
// $builder->get('/api/{matchgrid_id}/v1/people/{sor}/{sorid}?*', ['controller' => 'TierApi', 'action' => 'search']);
$builder->delete('/api/{matchgrid_id}/v1/people/{sor}/{sorid}', ['controller' => 'TierApi', 'action' => 'remove']);
$builder->get('/api/{matchgrid_id}/v1/people/{sor}/{sorid}', ['controller' => 'TierApi', 'action' => 'current']);
$builder->get('/api/{matchgrid_id}/v1/people/{sor}', ['controller' => 'TierApi', 'action' => 'inventory']);
$builder->put('/api/{matchgrid_id}/v1/referenceIds/{id}', ['controller' => 'TierApi', 'action' => 'merge']);
// $builder->get('/api/{matchgrid_id}/v1/people/{sor}/{sorid}?*', ['controller' => 'TapApi', 'action' => 'search']);
$builder->delete('/api/{matchgrid_id}/v1/people/{sor}/{sorid}', ['controller' => 'TapApi', 'action' => 'remove']);
$builder->get('/api/{matchgrid_id}/v1/people/{sor}/{sorid}', ['controller' => 'TapApi', 'action' => 'current']);
$builder->get('/api/{matchgrid_id}/v1/people/{sor}', ['controller' => 'TapApi', 'action' => 'inventory']);
$builder->put('/api/{matchgrid_id}/v1/referenceIds/{id}', ['controller' => 'TapApi', 'action' => 'merge']);

/**
* Connect catchall routes for all controllers.
6 changes: 3 additions & 3 deletions app/resources/locales/en_US/default.po
@@ -348,15 +348,15 @@ msgstr "No type defined for table {0} column {1}"
msgid "match.er.schema.parse"
msgstr "Failed to parse file {0}"

msgid "match.er.unauthorized"
msgstr "{0} does not have any valid permissions"

msgid "match.er.search_type"
msgstr "Unknown search type '{0}'"

msgid "match.er.table"
msgstr "Matchgrid table %1$s does not exist"

msgid "match.er.unauthorized"
msgstr "Unauthorized (see logs for more details)"

msgid "match.er.val.email"
msgstr "Provided value does not appear to be an email address"

2 changes: 1 addition & 1 deletion app/src/Application.php
@@ -41,7 +41,7 @@ public function middleware(\Cake\Http\MiddlewareQueue $middlewareQueue): \Cake\H
$csrf = new CsrfProtectionMiddleware(['cookieName' => 'matchCsrfToken']);
$csrf->skipCheckCallback(function (ServerRequestInterface $request) {
// skip controllers
$skipedControllers = ['TierApi']; // Controllers list
$skipedControllers = ['TapApi']; // Controllers list
if(in_array($request->getParam('controller'), $skipedControllers, true)) {
return true;
}
18 changes: 6 additions & 12 deletions app/src/Command/DatabaseCommand.php
@@ -46,6 +46,8 @@
use Doctrine\DBAL\Schema\SchemaDiff;

class DatabaseCommand extends Command {
use \App\Lib\Traits\DatabaseTrait;

/**
* Build an Option Parser.
*
@@ -108,23 +110,13 @@ public function execute(Arguments $args, ConsoleIo $io) {
throw new \RuntimeException(__($COmponent.'.er.schema.parse', [$schemaFile]));
}

// Use the ConnectionManager to get the database config to pass to adodb.
// Use the ConnectionManager to get the database config for use below
$db = ConnectionManager::get('default');

// $db is a ConnectionInterface object
$cfg = $db->config();

$config = new \Doctrine\DBAL\Configuration();

$cfargs = [
'dbname' => $cfg['database'],
'user' => $cfg['username'],
'password' => $cfg['password'],
'host' => $cfg['host'],
'driver' => ($cfg['driver'] == 'Cake\Database\Driver\Postgres' ? "pdo_pgsql" : "pdo_mysql")
];

$conn = DriverManager::getConnection($cfargs, $config);
$conn = $this->connectDatabase();

$schema = new Schema();

@@ -277,5 +269,7 @@ public function execute(Arguments $args, ConsoleIo $io) {
// We might run bin/cake schema_cache clear or
// bin/cake schema_cache build --connection default
// but so far we don't have an example indicating it's needed.

$this->disconnectDatabase();
}
}

0 comments on commit d1cf34d

Please sign in to comment.