Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Dec 22, 2018
1 parent e17d86c commit 5693b8c
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 323 deletions.
5 changes: 2 additions & 3 deletions app/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@
*/

// Match Request
// XXX should we use TierApiV1Controller? or v1match?
$routes->get('/api/:matchgrid_id/v1/matchRequests/:id', ['controller' => 'TierApi', 'action' => 'viewMatchRequest']);
$routes->get('/api/:matchgrid_id/v1/matchRequests', ['controller' => 'TierApi', 'action' => 'viewMatchRequests']);
$routes->put('/api/:matchgrid_id/v1/people/:sor/:sorid', ['controller' => 'TierApi', 'action' => 'match']);
$routes->post('/api/:matchgrid_id/v1/people/:sor/:sorid', ['controller' => 'TierApi', 'action' => 'search']);
// XXX do we need the ?* here? (it breaks matchRequests -> viewMatchRequests)
$routes->get('/api/:matchgrid_id/v1/people/:sor/:sorid?*', ['controller' => 'TierApi', 'action' => 'search']);
// This doesn't match and we end up in current(), so we just check there
// $routes->get('/api/:matchgrid_id/v1/people/:sor/:sorid?*', ['controller' => 'TierApi', 'action' => 'search']);
$routes->delete('/api/:matchgrid_id/v1/people/:sor/:sorid', ['controller' => 'TierApi', 'action' => 'remove']);
$routes->get('/api/:matchgrid_id/v1/people/:sor/:sorid', ['controller' => 'TierApi', 'action' => 'current']);
$routes->get('/api/:matchgrid_id/v1/people/:sor', ['controller' => 'TierApi', 'action' => 'inventory']);
Expand Down
9 changes: 0 additions & 9 deletions app/config/schema/schema.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@
must be specified in raw SQL, which needs the prefixed table name.
-->
<schema version="0.3">
<!--
XXX document datamodel
-->

<table name="meta">
<field name="id" type="I">
<key />
Expand Down Expand Up @@ -171,11 +167,6 @@
<index name="rule_attributes_i1">
<col>rule_id</col>
</index>

<!-- XXX do we really need this index? -->
<index name="rule_attributes_i1">
<col>attribute_id</col>
</index>
</table>

<table name="systems_of_record">
Expand Down
20 changes: 20 additions & 0 deletions app/src/Controller/ApiUsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,27 @@

namespace App\Controller;

use Cake\Routing\Router;

class ApiUsersController extends StandardController {
/**
* Callback run prior to the view rendering.
*
* @since COmanage Match v1.0.0
* @param Event $event Cake Event
*/

public function beforeRender(\Cake\Event\Event $event) {
parent::beforeRender($event);

// Populate a pointer to the REST API for configuration purposes
$mgid = isset($this->cur_mg->id) ? $this->cur_mg->id : null;

$fragment = "/api/" . ($mgid ? $mgid : "{matchgrid_id}") . "/v1";

$this->set('vv_api_uri', Router::url($fragment, true));
}

/**
* Authorization for this Controller, called by Auth component
* - postcondition: $vv_permissions set with calculated permissions for this Controller
Expand Down
Loading

0 comments on commit 5693b8c

Please sign in to comment.