You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

216 lines
11 KiB

4 years ago
4 years ago
4 years ago
  1. <?php
  2. /** @var \Illuminate\Routing\$router */
  3. $router->get('/lab', function () {
  4. throw new \Exception("^_^");
  5. });
  6. $router->get('/ntest', function () {
  7. $user = \App\Models\User::find(1);
  8. \Illuminate\Support\Facades\Notification::send($user, new \App\Notifications\SocketNotification(['title' => "hello!!!", 'body' => 'sss']));
  9. })->middleware('bindBusiness');
  10. $router->group(['prefix' => 'actions'], function () use ($router) {
  11. $router->group(['prefix' => 'businesses'], function () use ($router) {
  12. $router->group(['prefix' => '{business}', 'middleware' => 'bindBusiness'], function () use ($router) {
  13. $router->get('/info', 'BusinessController@info');
  14. });
  15. });
  16. });
  17. $router->get('/callback', 'CreditController@callback');
  18. $router->get('/{transaction}/redirection', 'CreditController@redirection');
  19. $router->group(['prefix' => 'auth'], function () use ($router) {
  20. $router->get('/', 'AuthController@auth')->middleware('auth:api');
  21. $router->delete('/', 'AuthController@delete');
  22. $router->get('/info', 'AuthController@authWithInfo')->middleware('auth:api');
  23. $router->post('login', 'AuthController@login');
  24. $router->post('logout', 'AuthController@logout')->middleware('auth:api');
  25. $router->post('register', 'AuthController@register');
  26. $router->post('revoke/{token}', 'AuthController@revoke');
  27. $router->post('forget-password', 'AuthController@forgetPassword');
  28. $router->post('update-password', 'AuthController@updatePassword');
  29. $router->post('verification', 'AuthController@verification');
  30. $router->get('google/redirect', 'AuthController@redirectToGoogle')->name('google.redirect');
  31. $router->get('google/callback', 'AuthController@handleGoogleCallback')->name('google.callback');
  32. $router->get('update-fcm', 'AuthController@updateFcmToken')->middleware('auth:api');
  33. });
  34. $router->group(['prefix' => 'businesses', 'middleware' => 'auth:api'], function () use ($router) {
  35. $router->get('/', 'BusinessController@index');
  36. $router->post('/', 'BusinessController@store');
  37. $router->group(['prefix' => '{business}', 'middleware' => 'bindBusiness'], function () use ($router) {
  38. $router->get('/notifications', 'NotificationController@index');
  39. $router->get('/notifications/{notification}/read', 'NotificationController@markAsRead');
  40. $router->get('/tasks', 'TaskController@index');
  41. $router->get('/works', 'WorkController@index');
  42. $router->get('statistics', 'StatisticController@index');
  43. $router->put('/avatar', 'BusinessController@setAvatar');
  44. $router->delete('/avatar', 'BusinessController@unSetAvatar');
  45. $router->get('/', 'BusinessController@show');
  46. $router->put('/', 'BusinessController@update');
  47. $router->delete('/', 'BusinessController@delete');
  48. $router->get('/restore', 'BusinessController@restore');
  49. $router->get('/files', 'FileController@index');
  50. $router->get('/info', 'BusinessController@info');
  51. $router->get('/invoices', 'InvoiceController@index');
  52. $router->get('/invoices/{date}', 'InvoiceController@show');
  53. $router->get('/pay', 'CreditController@pay');
  54. $router->get('/payments', 'CreditController@payments');
  55. $router->group(['prefix' => 'projects'], function () use ($router) {
  56. $router->get('/', 'ProjectController@index');
  57. $router->post('/', 'ProjectController@store');
  58. $router->group(['prefix' => '{project}'], function () use ($router) {
  59. $router->put('/avatar', 'ProjectController@setAvatar');
  60. $router->delete('/avatar', 'ProjectController@unSetAvatar');
  61. $router->get('/statistics', 'StatisticController@index');
  62. $router->get('/', 'ProjectController@show');
  63. $router->put('/', 'ProjectController@update');
  64. $router->delete('/', 'ProjectController@delete');
  65. $router->group(['prefix' => 'files', 'as' => 'file.', 'middleware' => 'bindBusiness'], function () use ($router) {
  66. // $router->get('/', ['as' => 'index', 'uses' => 'FileController@index']);
  67. $router->post('/', ['as' => 'store', 'uses' => 'FileController@store']);
  68. $router->group(['prefix' => '{file}'], function () use ($router) {
  69. $router->get('/', ['as' => 'download', 'uses' => 'FileController@download']);
  70. $router->put('/', ['as' => 'rename', 'uses' => 'FileController@rename']);
  71. $router->delete('/', ['as' => 'delete', 'uses' => 'FileController@delete']);
  72. });
  73. });
  74. $router->get('/restore', 'ProjectController@restore');
  75. $router->group(['prefix' => 'sprints', 'as' => 'sprint.', 'middleware' => 'bindBusiness'], function () use ($router) {
  76. $router->get('/', ['as' => 'index', 'uses' => 'SprintController@index']);
  77. $router->post('/', ['as' => 'store', 'uses' => 'SprintController@store']);
  78. $router->group(['prefix' => '{sprint}'], function () use ($router) {
  79. $router->get('/', ['as' => 'show', 'uses' => 'SprintController@show']);
  80. $router->put('/', ['as' => 'update', 'uses' => 'SprintController@update']);
  81. $router->delete('/', ['as' => 'delete', 'uses' => 'SprintController@delete']);
  82. });
  83. });
  84. $router->group(['prefix' => 'systems', 'middleware' => 'bindBusiness'], function () use ($router) {
  85. $router->get('/', 'SystemController@index');
  86. $router->post('/', 'SystemController@store');
  87. $router->group(['prefix' => '{system}'], function () use ($router) {
  88. $router->get('/', 'SystemController@show');
  89. $router->put('/', 'SystemController@update');
  90. $router->delete('/', 'SystemController@delete');
  91. });
  92. });
  93. $router->group(['prefix' => 'tasks/{task}/files', 'middleware' => 'bindBusiness'], function () use ($router) {
  94. $router->get('/', ['uses' => 'TaskFileController@index']);
  95. $router->post('/', ['uses' => 'TaskFileController@sync']);
  96. $router->get('/{file}', ['uses' => 'TaskFileController@download']);
  97. });
  98. $router->group(['prefix' => 'users'], function () use ($router){
  99. $router->post('/', 'ProjectController@storeOrUpdateUser');
  100. $router->group(['prefix' => '{user}'], function () use ($router) {
  101. $router->delete('/', 'ProjectController@deleteUser');
  102. });
  103. });
  104. $router->group(['prefix' => 'tasks'], function ($router) {
  105. $router->post('/', 'TaskController@store');
  106. $router->group(['prefix' => '{task}'], function ($router) {
  107. $router->get('/', 'TaskController@show');
  108. $router->put('/', 'TaskController@update');
  109. $router->delete('/', 'TaskController@destroy');
  110. $router->post('/watchers', 'TaskController@toggleWatcher');
  111. $router->group(['prefix' => 'works'], function ($router) {
  112. $router->post('/', 'WorkController@store');
  113. $router->group(['prefix' => '{work}'], function ($router) {
  114. $router->get('/', 'WorkController@show');
  115. $router->put('/', 'WorkController@update');
  116. $router->delete('/', 'WorkController@destroy');
  117. });
  118. });
  119. $router->group(['prefix' => 'comments'], function ($router) {
  120. $router->get('/', 'CommentController@index');
  121. $router->post('/', 'CommentController@store');
  122. $router->group(['prefix' => '{comment}'], function ($router) {
  123. $router->get('/', 'CommentController@show');
  124. $router->put('/', 'CommentController@update');
  125. $router->delete('/', 'CommentController@destroy');
  126. });
  127. });
  128. });
  129. });
  130. });
  131. });
  132. $router->group(['prefix' => 'tags', 'as' => 'tag.', 'middleware' => 'bindBusiness'], function () use ($router) {
  133. $router->get('/', ['as' => 'index', 'uses' => 'TagController@index']);
  134. $router->post('/', ['as' => 'store', 'uses' => 'TagController@store']);
  135. $router->group(['prefix' => '{tag}'], function () use ($router) {
  136. $router->get('/', ['as' => 'show', 'uses' => 'TagController@show']);
  137. $router->put('/', ['as' => 'update', 'uses' => 'TagController@update']);
  138. $router->delete('/', ['as' => 'delete', 'uses' => 'TagController@delete']);
  139. });
  140. });
  141. $router->group(['prefix' => 'workflows', 'as' => 'workflow.', 'middleware' => 'bindBusiness'], function () use ($router) {
  142. $router->get('/', ['as' => 'index', 'uses' => 'WorkflowController@index']);
  143. $router->post('/', ['as' => 'store', 'uses' => 'WorkflowController@store']);
  144. $router->group(['prefix' => '{workflow}'], function () use ($router) {
  145. $router->get('/', ['as' => 'show', 'uses' => 'WorkflowController@show']);
  146. $router->put('/', ['as' => 'update', 'uses' => 'WorkflowController@update']);
  147. $router->delete('/', ['as' => 'delete', 'uses' => 'WorkflowController@delete']);
  148. $router->group(['prefix' => 'statuses', 'middleware' => 'bindBusiness'], function () use ($router) {
  149. $router->get('/', 'StatusController@index');
  150. $router->post('/', 'StatusController@store');
  151. $router->group(['prefix' => '{status}'], function () use ($router) {
  152. $router->get('/', 'StatusController@show');
  153. $router->put('/', 'StatusController@update');
  154. $router->delete('/', ['as' => 'delete', 'uses' => 'StatusController@delete']);
  155. });
  156. });
  157. });
  158. });
  159. $router->group(['prefix' => 'users'], function () use ($router){
  160. $router->post('/', 'BusinessController@storeOrUpdateUser');
  161. $router->group(['prefix' => '{user}'], function () use ($router) {
  162. $router->delete('/', 'BusinessController@deleteUser');
  163. });
  164. });
  165. $router->group(['prefix' => 'activities'], function () use ($router) {
  166. $router->post('/', 'ActivityController@store');
  167. $router->get('/', 'ActivityController@index');
  168. });
  169. });
  170. });
  171. $router->group(['prefix' => 'users','middleware' => 'bindBusiness'], function () use ($router) {
  172. $router->get('/', 'UserController@index');
  173. $router->get('/search', 'UserController@search');
  174. $router->group(['prefix' => '{user}'], function () use ($router) {
  175. $router->get('/', 'UserController@show');
  176. $router->put('/', 'UserController@update');
  177. $router->put('/avatar', 'UserController@setAvatar');
  178. $router->delete('/avatar', 'UserController@unSetAvatar');
  179. });
  180. });