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.

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