From 176458893de06e3ea801743162a07b43326d6929 Mon Sep 17 00:00:00 2001 From: mahdihty Date: Tue, 2 Mar 2021 17:34:34 +0330 Subject: [PATCH] merge task, user routes --- docker-compose.yml | 6 ++-- routes/api.php | 78 +++++++++++++++++++++------------------------- 2 files changed, 39 insertions(+), 45 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 3093ea1..96ea2ee 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,7 +16,7 @@ services: volumes: - ./definitions.json:/etc/rabbitmq/definitions.json depends_on: - - laravel + - laravel.test minio: image: minio/minio command: server /data @@ -28,7 +28,7 @@ services: networks: - sail depends_on: - - laravel + - laravel.test commander: image: rediscommander/redis-commander:latest environment: @@ -54,7 +54,7 @@ services: - redis-data:/data networks: - sail - laravel: + laravel.test: build: context: ./vendor/laravel/sail/runtimes/8.0 dockerfile: Dockerfile diff --git a/routes/api.php b/routes/api.php index 39ab57b..463c255 100644 --- a/routes/api.php +++ b/routes/api.php @@ -12,6 +12,7 @@ $router->group(['prefix' => 'actions'], function () use ($router) { $router->get('/callback', 'CreditController@callback'); $router->get('/{transaction}/redirection', 'CreditController@redirection'); +$router->post('/log', 'ActivityController@store'); $router->group(['prefix' => 'auth'], function () use ($router) { $router->get('/', 'AuthController@auth'); @@ -37,6 +38,9 @@ $router->group(['prefix' => 'businesses'], function () use ($router) { $router->group(['prefix' => '{business}', 'middleware' => 'bindBusiness'], function () use ($router) { + $router->get('/tasks', 'TaskController@index'); + $router->get('/works', 'WorkController@index'); + $router->get('statistics', 'StatisticController@index'); $router->put('/avatar', 'BusinessController@setAvatar'); $router->delete('/avatar', 'BusinessController@unSetAvatar'); @@ -61,6 +65,7 @@ $router->group(['prefix' => 'businesses'], function () use ($router) { $router->put('/avatar', 'ProjectController@setAvatar'); $router->delete('/avatar', 'ProjectController@unSetAvatar'); + $router->get('/statistics', 'StatisticController@index'); $router->get('/', 'ProjectController@show'); $router->put('/', 'ProjectController@update'); @@ -109,6 +114,37 @@ $router->group(['prefix' => 'businesses'], function () use ($router) { }); }); + $router->group(['prefix' => 'tasks'], function ($router) { + $router->post('/', 'TaskController@store'); + $router->group(['prefix' => '{task}'], function ($router) { + $router->get('/', 'TaskController@show'); + $router->put('/', 'TaskController@update'); + $router->delete('/', 'TaskController@destroy'); + + $router->post('/watchers', 'TaskController@toggleWatcher'); + + $router->group(['prefix' => 'works'], function ($router) { + $router->post('/', 'WorkController@store'); + $router->group(['prefix' => '{work}'], function ($router) { + $router->get('/', 'WorkController@show'); + $router->put('/', 'WorkController@update'); + $router->delete('/', 'WorkController@destroy'); + }); + }); + + $router->group(['prefix' => 'comments'], function ($router) { + $router->get('/', 'CommentController@index'); + $router->post('/', 'CommentController@store'); + $router->group(['prefix' => '{comment}'], function ($router) { + $router->get('/', 'CommentController@show'); + $router->put('/', 'CommentController@update'); + $router->delete('/', 'CommentController@destroy'); + }); + }); + + }); + }); + }); }); @@ -161,45 +197,3 @@ $router->group(['prefix' => 'users'], function () use ($router) { $router->delete('/avatar', 'UserController@unSetAvatar'); }); }); - -$router->group([], function () use ($router) { - $router->post('/log', 'ActivityController@store'); - $router->group(['prefix' => 'businesses/{business}', 'middleware' => ['auth', 'bindBusiness']], function ($router) { - $router->get('/tasks', 'TaskController@index'); - $router->get('/works', 'WorkController@index'); - $router->get('statistics', 'StatisticController@index'); - $router->get('projects/{project}/statistics', 'StatisticController@index'); - $router->get('/tasks/{task}', 'TaskController@show'); - $router->group(['prefix' => 'projects/{project}/tasks'], function ($router) { - $router->post('/', 'TaskController@store'); - - $router->group(['prefix' => '{task}'], function ($router) { - $router->get('/', 'TaskController@show'); - $router->put('/', 'TaskController@update'); - $router->delete('/', 'TaskController@destroy'); - - $router->post('/watchers', 'TaskController@toggleWatcher'); - - $router->group(['prefix' => 'works'], function ($router) { - $router->post('/', 'WorkController@store'); - $router->group(['prefix' => '{work}'], function ($router) { - $router->get('/', 'WorkController@show'); - $router->put('/', 'WorkController@update'); - $router->delete('/', 'WorkController@destroy'); - }); - }); - - $router->group(['prefix' => 'comments'], function ($router) { - $router->get('/', 'CommentController@index'); - $router->post('/', 'CommentController@store'); - $router->group(['prefix' => '{comment}'], function ($router) { - $router->get('/', 'CommentController@show'); - $router->put('/', 'CommentController@update'); - $router->delete('/', 'CommentController@destroy'); - }); - }); - - }); - }); - }); -});