Skip to content

Commit

Permalink
feat: make routes cachable (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
warlof authored Jun 13, 2020
1 parent 8be5761 commit a0405de
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 64 deletions.
5 changes: 3 additions & 2 deletions src/ApiServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ public function apply_custom_configuration()
config(['l5-swagger.constants.L5_SWAGGER_CONST_HOST' => sprintf('%s/api', env('APP_URL'))]);

// SwaggerUI long description.
config(['l5-swagger.constants.L5_SWAGGER_DESCRIPTION' => 'SeAT API Documentation. ' .
'All endpoints require an API key. Keys may be obtained from: ' . route('api-admin.list'), ]);
config([
'l5-swagger.constants.L5_SWAGGER_DESCRIPTION' => 'SeAT API Documentation. All endpoints require an API key.',
]);
}

/**
Expand Down
125 changes: 63 additions & 62 deletions src/Http/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

use Illuminate\Support\Facades\Route;

Route::group([
'namespace' => 'Seat\Api\Http\Controllers',
], function () {
Expand All @@ -32,20 +34,19 @@
'middleware' => ['auth', 'can:global.superuser'],
'prefix' => 'api-admin',
], function () {

Route::get('/', [
'as' => 'api-admin.list',
'uses' => 'ApiAdminController@listTokens', ]);
Route::post('/', [
'as' => 'api-admin.token.create',
'uses' => 'ApiAdminController@generateToken', ]);
Route::get('/logs/{token_id}', [
'as' => 'api-admin.token.logs',
'uses' => 'ApiAdminController@show', ]);
Route::get('/delete/{token_id}', [
'as' => 'api-admin.token.delete',
'uses' => 'ApiAdminController@deleteToken', ]);

Route::get('/')
->name('api-admin.list')
->uses('ApiAdminController@listTokens');

Route::post('/')
->name('api-admin.token.create')
->uses('ApiAdminController@generateToken');
Route::get('/logs/{token_id}')
->name('api-admin.token.logs')
->uses('ApiAdminController@show');
Route::get('/delete/{token_id}')
->name('api-admin.token.delete')
->uses('ApiAdminController@deleteToken');
});
});

Expand All @@ -61,79 +62,79 @@

Route::group(['prefix' => 'users'], function () {

Route::post('/', 'UserController@postNewUser');
Route::delete('/{user_id}', 'UserController@deleteUser');
Route::post('/')->uses('UserController@postNewUser');
Route::delete('/{user_id}')->uses('UserController@deleteUser');

Route::get('/', 'UserController@getUsers');
Route::get('/{user_id}', 'UserController@show')->where(['user_id' => '[0-9]+']);
Route::get('/')->uses('UserController@getUsers');
Route::get('/{user_id}')->uses('UserController@show')->where(['user_id' => '[0-9]+']);

Route::get('/configured-scopes', 'UserController@getConfiguredScopes');
Route::get('/configured-scopes')->uses('UserController@getConfiguredScopes');
});

Route::group(['prefix' => 'squads'], function () {
Route::get('/', 'SquadController@index');
Route::get('/{squad_id}', 'SquadController@show');
Route::post('/', 'SquadController@store');
Route::put('/{squad_id}', 'SquadController@update');
Route::delete('/{squad_id}', 'SquadController@destroy');
Route::get('/')->uses('SquadController@index');
Route::get('/{squad_id}')->uses('SquadController@show');
Route::post('/')->uses('SquadController@store');
Route::put('/{squad_id}')->uses('SquadController@update');
Route::delete('/{squad_id}')->uses('SquadController@destroy');
});

Route::group(['prefix' => 'roles'], function () {

Route::get('/', 'RoleController@getIndex');
Route::get('/{role_id}', 'RoleController@getDetail')->where('role_id', '[0-9]+');
Route::post('/', 'RoleController@postNew');
Route::patch('/{role_id}', 'RoleController@patch')->where('role_id', '[0-9]+');
Route::delete('/{role_id}', 'RoleController@deleteRole')->where('role_id', '[0-9]+');
Route::post('/members', 'RoleController@postGrantUserRole');
Route::delete('/members/{user_id}/{role_id}', 'RoleController@deleteRevokeUserRole');
Route::get('/')->uses('RoleController@getIndex');
Route::get('/{role_id}')->uses('RoleController@getDetail')->where('role_id', '[0-9]+');
Route::post('/')->uses('RoleController@postNew');
Route::patch('/{role_id}')->uses('RoleController@patch')->where('role_id', '[0-9]+');
Route::delete('/{role_id}')->uses('RoleController@deleteRole')->where('role_id', '[0-9]+');
Route::post('/members')->uses('RoleController@postGrantUserRole');
Route::delete('/members/{user_id}/{role_id}')->uses('RoleController@deleteRevokeUserRole');

Route::group(['prefix' => 'query'], function () {

Route::get('/permissions', 'RoleLookupController@getPermissions');
Route::get('/role-check/{character_id}/{role_name}', 'RoleLookupController@getRoleCheck');
Route::get('/permission-check/{character_id}/{permission_name}', 'RoleLookupController@getPermissionCheck');
Route::get('/permissions')->uses('RoleLookupController@getPermissions');
Route::get('/role-check/{character_id}/{role_name}')->uses('RoleLookupController@getRoleCheck');
Route::get('/permission-check/{character_id}/{permission_name}')->uses('RoleLookupController@getPermissionCheck');
});
});

Route::group(['prefix' => 'killmails'], function () {

Route::get('/{killmail_id}', 'KillmailsController@getDetail');
Route::get('/{killmail_id}')->uses('KillmailsController@getDetail');
});

Route::group(['prefix' => 'character'], function () {

Route::get('/assets/{character_id}/{item_id?}', 'CharacterController@getAssets');
Route::get('/bookmarks/{character_id}', 'CharacterController@getBookmarks');
Route::get('/contacts/{character_id}', 'CharacterController@getContacts');
Route::get('/industry/{character_id}', 'CharacterController@getIndustry');
Route::get('/killmails/{character_id}/{killmail_id?}', 'KillmailsController@getCharacterKillmails');
Route::get('/market-orders/{character_id}', 'CharacterController@getMarketOrders');
Route::get('/contracts/{character_id}', 'CharacterController@getContracts');
Route::get('/sheet/{character_id}', 'CharacterController@getSheet');
Route::get('/skills/{character_id}', 'CharacterController@getSkills');
Route::get('/skill-queue/{character_id}', 'CharacterController@getSkillQueue');
Route::get('/wallet-journal/{character_id}', 'CharacterController@getWalletJournal');
Route::get('/wallet-transactions/{character_id}', 'CharacterController@getWalletTransactions');
Route::get('/corporation-history/{character_id}', 'CharacterController@getCorporationHistory');
Route::get('/jump-clones/{character_id}', 'CharacterController@getJumpClones');
Route::get('/mail/{character_id}', 'CharacterController@getMail');
Route::get('/notifications/{character_id}', 'CharacterController@getNotifications');
Route::get('/assets/{character_id}/{item_id?}')->uses('CharacterController@getAssets');
Route::get('/bookmarks/{character_id}')->uses('CharacterController@getBookmarks');
Route::get('/contacts/{character_id}')->uses('CharacterController@getContacts');
Route::get('/industry/{character_id}')->uses('CharacterController@getIndustry');
Route::get('/killmails/{character_id}/{killmail_id?}')->uses('KillmailsController@getCharacterKillmails');
Route::get('/market-orders/{character_id}')->uses('CharacterController@getMarketOrders');
Route::get('/contracts/{character_id}')->uses('CharacterController@getContracts');
Route::get('/sheet/{character_id}')->uses('CharacterController@getSheet');
Route::get('/skills/{character_id}')->uses('CharacterController@getSkills');
Route::get('/skill-queue/{character_id}')->uses('CharacterController@getSkillQueue');
Route::get('/wallet-journal/{character_id}')->uses('CharacterController@getWalletJournal');
Route::get('/wallet-transactions/{character_id}')->uses('CharacterController@getWalletTransactions');
Route::get('/corporation-history/{character_id}')->uses('CharacterController@getCorporationHistory');
Route::get('/jump-clones/{character_id}')->uses('CharacterController@getJumpClones');
Route::get('/mail/{character_id}')->uses('CharacterController@getMail');
Route::get('/notifications/{character_id}')->uses('CharacterController@getNotifications');
});

Route::group(['prefix' => 'corporation'], function () {

Route::get('/assets/{corporation_id}', 'CorporationController@getAssets');
Route::get('/bookmarks/{corporation_id}', 'CorporationController@getBookmarks');
Route::get('/contacts/{corporation_id}', 'CorporationController@getContacts');
Route::get('/contracts/{corporation_id}', 'CorporationController@getContracts');
Route::get('/industry/{corporation_id}', 'CorporationController@getIndustry');
Route::get('/killmails/{corporation_id}', 'KillmailsController@getCorporationKillmails');
Route::get('/market-orders/{corporation_id}', 'CorporationController@getMarketOrders');
Route::get('/member-tracking/{corporation_id}', 'CorporationController@getMemberTracking');
Route::get('/sheet/{corporation_id}', 'CorporationController@getSheet');
Route::get('/wallet-journal/{corporation_id}', 'CorporationController@getWalletJournal');
Route::get('/wallet-transactions/{corporation_id}', 'CorporationController@getWalletTransactions');
Route::get('/assets/{corporation_id}')->uses('CorporationController@getAssets');
Route::get('/bookmarks/{corporation_id}')->uses('CorporationController@getBookmarks');
Route::get('/contacts/{corporation_id}')->uses('CorporationController@getContacts');
Route::get('/contracts/{corporation_id}')->uses('CorporationController@getContracts');
Route::get('/industry/{corporation_id}')->uses('CorporationController@getIndustry');
Route::get('/killmails/{corporation_id}')->uses('KillmailsController@getCorporationKillmails');
Route::get('/market-orders/{corporation_id}')->uses('CorporationController@getMarketOrders');
Route::get('/member-tracking/{corporation_id}')->uses('CorporationController@getMemberTracking');
Route::get('/sheet/{corporation_id}')->uses('CorporationController@getSheet');
Route::get('/wallet-journal/{corporation_id}')->uses('CorporationController@getWalletJournal');
Route::get('/wallet-transactions/{corporation_id}')->uses('CorporationController@getWalletTransactions');
});
});

Expand Down

0 comments on commit a0405de

Please sign in to comment.