api routes

mail@pastecode.io avatar
unknown
plain_text
2 years ago
4.3 kB
3
Indexable
Never
<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', 'UserController@user');

Route::post('/login', 'UserController@login');

Route::get('/users/verify', 'UserController@verify')->name('users.verify');
Route::apiResource('users', 'UserController');

// Route::get('/accounts/{account}/integrations', 'EmailIntegrationController')->name('integrations');
Route::get('/accounts/{account}/integrations/redirect', 'IntegrationController@redirect')->name('integrations');
Route::post('/accounts/{account}/integrations/{integration}/sync', 'IntegrationController@sync')->name('sync-integration');
Route::apiResource('accounts.integrations', 'IntegrationController');

Route::apiResource('accounts.products', 'ProductController');
Route::apiResource('accounts.products.productstockkeepingunits', 'ProductStockKeepingUnitController');

// Bulk delete products
Route::delete('accounts/{account}/products', 'ProductController@destroyMany');
Route::get('accounts/{account}/products/{product}/logs', 'ProductController@logs');

// ProductCategory Endpoints
Route::apiResource('accounts.productcategories', 'ProductCategoryController');
Route::delete('accounts/{account}/productcategories', 'ProductCategoryController@destroyMany');
Route::get('accounts/{account}/productcategories/{productcategory}/logs', 'ProductCategoryController@logs');


// Account -> User Endpoints
Route::apiResource('accounts.users', 'AccountUserController');
Route::delete('accounts/{account}/users', 'AccountUserController@destroyMany');
Route::post('accounts/{account}/user_invitations', 'AccountUserController@inviteUsers');
Route::get('accounts/{account}/users/{user}/logs', 'AccountUserController@logs');
Route::get('accounts/{account}/users/{user}/bearer', 'AccountUserController@loginAs');

// Account -> Contacts
Route::apiResource('accounts.contacts', 'ContactController');
Route::delete('accounts/{account}/contacts', 'ContactController@destroyMany');
Route::get('accounts/{account}/contacts/{contact}/logs', 'ContactController@logs');
Route::get('accounts/{account}/contacts/{contact}/leads', 'ContactController@leads');
Route::get('accounts/{account}/contacts/{contact}/notes', 'ContactController@notes');
Route::get('accounts/{account}/contacts/{contact}/files', 'ContactController@files');

Route::group(['namespace' => 'Contacts'], function () {
    Route::apiResource('accounts.contacts.locations', 'ContactAddressController');
    Route::apiResource('accounts.contacts.attributes', 'ContactAttributeController');


    Route::apiResource('accounts.contacts.emails', 'ContactEmailController');
    Route::apiResource('accounts.contacts.phones', 'ContactPhoneController');

    Route::apiResource('accounts.contacts.files', 'ContactFileController');
});

// Account -> Leads
Route::get('/accounts/{account}/leads/with-no-contacts', 'LeadController@indexNoContactAssociation');
Route::get('/accounts/{account}/leads/{lead}/logs', 'LeadController@logs');
Route::get('/accounts/{account}/leads/{lead}/notes', 'LeadController@notes');


Route::apiResource('accounts.leads', 'LeadController');
Route::apiResource('accounts.leads.files', 'LeadFileController');
Route::apiResource('accounts.leads.outcomes', 'LeadOutcomeController');

// Workflows and Stages
Route::get('/accounts/{account}/workflows/{workflow}/stages', 'WorkflowStageController');

// Account -> Notes
Route::apiResource('accounts.notes', 'NoteController');

// MessageCentre
Route::apiResource('accounts.messages', 'MessageController');

Route::middleware('auth:api')
    ->get('accounts/{account}/permissions', 'UserAccountPermissionController@index');

Route::group([
    'namespace'         => 'Auth',
    'middleware'        => 'api',
    'prefix'            => 'passwords',
], function () {
    Route::post('email', 'ForgotPasswordController@sendResetLinkEmail');
    Route::post('reset', 'ResetPasswordController@reset');
});