cats_core 1.5.17 → 1.5.19

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +7 -7
  3. data/app/controllers/cats/core/access_controller.rb +4 -4
  4. data/app/controllers/cats/core/application_controller.rb +4 -4
  5. data/app/controllers/cats/core/commodities_controller.rb +7 -7
  6. data/app/controllers/cats/core/commodity_categories_controller.rb +4 -4
  7. data/app/controllers/cats/core/dispatch_authorizations_controller.rb +22 -9
  8. data/app/controllers/cats/core/dispatch_plan_items_controller.rb +4 -4
  9. data/app/controllers/cats/core/dispatch_plans_controller.rb +10 -10
  10. data/app/controllers/cats/core/dispatch_transactions_controller.rb +5 -5
  11. data/app/controllers/cats/core/dispatches_controller.rb +19 -19
  12. data/app/controllers/cats/core/loans_controller.rb +1 -1
  13. data/app/controllers/cats/core/locations_controller.rb +4 -4
  14. data/app/controllers/cats/core/menus_controller.rb +1 -1
  15. data/app/controllers/cats/core/notifications_controller.rb +5 -5
  16. data/app/controllers/cats/core/purchase_orders_controller.rb +3 -3
  17. data/app/controllers/cats/core/receipt_authorizations_controller.rb +29 -17
  18. data/app/controllers/cats/core/receipt_transactions_controller.rb +4 -4
  19. data/app/controllers/cats/core/receipts_controller.rb +1 -1
  20. data/app/controllers/cats/core/roles_controller.rb +3 -3
  21. data/app/controllers/cats/core/round_beneficiaries_controller.rb +13 -13
  22. data/app/controllers/cats/core/round_plans_controller.rb +13 -13
  23. data/app/controllers/cats/core/routes_controller.rb +2 -2
  24. data/app/controllers/cats/core/spaces_controller.rb +1 -1
  25. data/app/controllers/cats/core/stack_transactions_controller.rb +3 -3
  26. data/app/controllers/cats/core/stacks_controller.rb +15 -7
  27. data/app/controllers/cats/core/stores_controller.rb +14 -14
  28. data/app/controllers/cats/core/swaps_controller.rb +2 -2
  29. data/app/controllers/cats/core/transporters_controller.rb +1 -1
  30. data/app/controllers/cats/core/users_controller.rb +24 -12
  31. data/app/controllers/concerns/cats/core/common.rb +24 -23
  32. data/app/helpers/cats/core/document_helper.rb +1 -1
  33. data/app/models/cats/core/authorization.rb +9 -9
  34. data/app/models/cats/core/beneficiary.rb +6 -6
  35. data/app/models/cats/core/beneficiary_plan_item.rb +9 -9
  36. data/app/models/cats/core/beneficiary_round_plan_item.rb +2 -2
  37. data/app/models/cats/core/cash_donation.rb +1 -1
  38. data/app/models/cats/core/commodity.rb +47 -33
  39. data/app/models/cats/core/commodity_donation.rb +2 -2
  40. data/app/models/cats/core/commodity_substitution.rb +15 -7
  41. data/app/models/cats/core/contract_item.rb +2 -2
  42. data/app/models/cats/core/dispatch.rb +36 -21
  43. data/app/models/cats/core/dispatch_authorization.rb +31 -5
  44. data/app/models/cats/core/dispatch_plan.rb +19 -10
  45. data/app/models/cats/core/dispatch_plan_item.rb +27 -14
  46. data/app/models/cats/core/dispatch_transaction.rb +15 -5
  47. data/app/models/cats/core/gift_certificate.rb +3 -3
  48. data/app/models/cats/core/hub_authorization.rb +7 -7
  49. data/app/models/cats/core/loan.rb +2 -2
  50. data/app/models/cats/core/location.rb +12 -8
  51. data/app/models/cats/core/lost_commodity.rb +2 -2
  52. data/app/models/cats/core/notification.rb +2 -2
  53. data/app/models/cats/core/offer_item.rb +4 -4
  54. data/app/models/cats/core/plan.rb +9 -9
  55. data/app/models/cats/core/plan_item.rb +5 -5
  56. data/app/models/cats/core/plan_item_detail.rb +2 -2
  57. data/app/models/cats/core/project.rb +1 -1
  58. data/app/models/cats/core/purchase_order.rb +5 -5
  59. data/app/models/cats/core/ration.rb +1 -1
  60. data/app/models/cats/core/receipt.rb +5 -5
  61. data/app/models/cats/core/receipt_authorization.rb +6 -2
  62. data/app/models/cats/core/receipt_transaction.rb +8 -4
  63. data/app/models/cats/core/rhn_request.rb +8 -8
  64. data/app/models/cats/core/role_menu.rb +1 -1
  65. data/app/models/cats/core/round_beneficiary.rb +10 -2
  66. data/app/models/cats/core/round_plan.rb +15 -11
  67. data/app/models/cats/core/round_plan_item.rb +9 -5
  68. data/app/models/cats/core/round_plan_item_detail.rb +3 -3
  69. data/app/models/cats/core/round_ration.rb +2 -2
  70. data/app/models/cats/core/route.rb +12 -8
  71. data/app/models/cats/core/stack.rb +52 -34
  72. data/app/models/cats/core/stack_transaction.rb +3 -3
  73. data/app/models/cats/core/stacking_rule.rb +2 -2
  74. data/app/models/cats/core/store.rb +29 -7
  75. data/app/models/cats/core/swap.rb +5 -5
  76. data/app/models/cats/core/transaction.rb +6 -6
  77. data/app/models/cats/core/transport_bid.rb +13 -13
  78. data/app/models/cats/core/transport_bid_item.rb +2 -2
  79. data/app/models/cats/core/transport_offer.rb +3 -3
  80. data/app/models/cats/core/transport_order.rb +8 -8
  81. data/app/models/cats/core/transport_order_item.rb +2 -2
  82. data/app/models/cats/core/transport_plan.rb +7 -7
  83. data/app/models/cats/core/transport_plan_item.rb +2 -2
  84. data/app/models/cats/core/transport_requisition.rb +9 -9
  85. data/app/models/cats/core/transport_requisition_detail.rb +2 -2
  86. data/app/models/cats/core/transport_requisition_item.rb +3 -3
  87. data/app/models/cats/core/transporter.rb +4 -0
  88. data/app/models/cats/core/unit_conversion.rb +4 -4
  89. data/app/models/cats/core/unit_of_measure.rb +4 -4
  90. data/app/models/cats/core/user.rb +11 -11
  91. data/app/models/concerns/cats/core/dispatchable.rb +3 -3
  92. data/app/notifications/cats/core/allocation_notification.rb +1 -1
  93. data/app/notifications/cats/core/dispatch_authorization_notification.rb +5 -1
  94. data/app/notifications/cats/core/dispatch_notification.rb +1 -1
  95. data/app/notifications/cats/core/receipt_authorization_notification.rb +1 -1
  96. data/app/notifications/cats/core/round_plan_notification.rb +1 -1
  97. data/app/notifications/cats/core/simple_notification.rb +1 -1
  98. data/app/serializers/cats/core/cash_donation_serializer.rb +1 -1
  99. data/app/serializers/cats/core/commodity_donation_serializer.rb +2 -2
  100. data/app/serializers/cats/core/commodity_serializer.rb +2 -2
  101. data/app/serializers/cats/core/dispatch_authorization_serializer.rb +2 -2
  102. data/app/serializers/cats/core/dispatch_plan_item_serializer.rb +3 -3
  103. data/app/serializers/cats/core/dispatch_plan_serializer.rb +1 -1
  104. data/app/serializers/cats/core/dispatch_serializer.rb +2 -2
  105. data/app/serializers/cats/core/dispatch_transaction_serializer.rb +1 -1
  106. data/app/serializers/cats/core/loan_serializer.rb +1 -1
  107. data/app/serializers/cats/core/purchase_order_serializer.rb +2 -2
  108. data/app/serializers/cats/core/receipt_authorization_serializer.rb +2 -2
  109. data/app/serializers/cats/core/receipt_serializer.rb +1 -1
  110. data/app/serializers/cats/core/receipt_transaction_serializer.rb +2 -2
  111. data/app/serializers/cats/core/round_beneficiary_serializer.rb +1 -1
  112. data/app/serializers/cats/core/round_plan_serializer.rb +1 -1
  113. data/app/serializers/cats/core/stack_serializer.rb +1 -1
  114. data/app/serializers/cats/core/store_serializer.rb +1 -1
  115. data/app/serializers/cats/core/swap_serializer.rb +2 -2
  116. data/app/services/cats/core/authorization_service.rb +22 -21
  117. data/app/services/cats/core/beneficiary_service.rb +11 -11
  118. data/app/services/cats/core/dispatch_plan_service.rb +10 -10
  119. data/app/services/cats/core/dispatch_service.rb +31 -31
  120. data/app/services/cats/core/notification_service.rb +5 -5
  121. data/app/services/cats/core/round_plan_service.rb +23 -23
  122. data/app/services/cats/core/space_service.rb +11 -11
  123. data/app/services/cats/core/stack_service.rb +10 -10
  124. data/app/services/cats/core/token_auth_service.rb +4 -4
  125. data/app/services/cats/core/user_service.rb +19 -0
  126. data/app/utils/cats/core/util.rb +1 -1
  127. data/config/routes.rb +110 -105
  128. data/config/spring.rb +1 -0
  129. data/db/migrate/20210715114910_create_cats_core_users.rb +3 -3
  130. data/db/migrate/20210715120018_create_cats_core_roles.rb +14 -14
  131. data/db/migrate/20210715121244_create_cats_core_menus.rb +3 -3
  132. data/db/migrate/20210715122141_create_cats_core_menu_items.rb +3 -3
  133. data/db/migrate/20210715122423_create_cats_core_role_menus.rb +13 -13
  134. data/db/migrate/20210717031810_create_cats_core_plans.rb +4 -4
  135. data/db/migrate/20210717032024_create_cats_core_plan_items.rb +18 -18
  136. data/db/migrate/20210717032260_create_cats_core_beneficiary_categories.rb +3 -3
  137. data/db/migrate/20210717032270_create_cats_core_rations.rb +10 -10
  138. data/db/migrate/20210717032290_create_cats_core_beneficiary_plan_items.rb +7 -7
  139. data/db/migrate/20210717032295_create_cats_core_plan_item_details.rb +7 -7
  140. data/db/migrate/20210717032330_create_cats_core_commodity_donations.rb +12 -12
  141. data/db/migrate/20210717032408_create_cats_core_cash_donations.rb +6 -6
  142. data/db/migrate/20210717032602_create_cats_core_gift_certificates.rb +12 -12
  143. data/db/migrate/20210717032855_create_cats_core_purchase_orders.rb +12 -12
  144. data/db/migrate/20210717032927_create_cats_core_projects.rb +3 -3
  145. data/db/migrate/20210717033223_create_cats_core_commodities.rb +10 -10
  146. data/db/migrate/20210717140855_create_cats_core_stores.rb +3 -3
  147. data/db/migrate/20210717171101_create_cats_core_stacks.rb +11 -11
  148. data/db/migrate/20210718040129_create_cats_core_routes.rb +9 -9
  149. data/db/migrate/20210718042755_create_cats_core_rhn_requests.rb +6 -6
  150. data/db/migrate/20210718043328_create_cats_core_dispatch_plans.rb +7 -7
  151. data/db/migrate/20210718043401_create_cats_core_dispatch_plan_items.rb +17 -17
  152. data/db/migrate/20210718045516_create_cats_core_dispatches.rb +13 -13
  153. data/db/migrate/20210718055414_create_cats_core_dispatch_authorizations.rb +13 -13
  154. data/db/migrate/20210718202957_create_cats_core_dispatch_transactions.rb +11 -11
  155. data/db/migrate/20210727074646_create_cats_core_receipt_authorizations.rb +13 -13
  156. data/db/migrate/20210727105834_create_cats_core_receipts.rb +6 -6
  157. data/db/migrate/20210728041505_create_cats_core_lost_commodities.rb +6 -6
  158. data/db/migrate/20210814160628_create_cats_core_receipt_transactions.rb +10 -10
  159. data/db/migrate/20210814175406_create_cats_core_stack_transactions.rb +10 -10
  160. data/db/migrate/20211024063240_add_status_to_cats_core_rhn_requests.rb +1 -1
  161. data/db/migrate/20211030133752_add_status_to_cats_core_commodities.rb +1 -1
  162. data/db/migrate/20211215114737_create_cats_core_transport_plans.rb +4 -4
  163. data/db/migrate/20211215114835_create_cats_core_transport_plan_items.rb +9 -9
  164. data/db/migrate/20211215121151_create_cats_core_transport_bids.rb +4 -4
  165. data/db/migrate/20211215124452_create_cats_core_transport_bid_items.rb +10 -10
  166. data/db/migrate/20211229160125_create_cats_core_transport_offers.rb +7 -7
  167. data/db/migrate/20211229160126_create_cats_core_offer_items.rb +6 -6
  168. data/db/migrate/20211229160127_create_cats_core_transport_contracts.rb +6 -6
  169. data/db/migrate/20211229160128_create_cats_core_contract_items.rb +9 -9
  170. data/db/migrate/20211229160129_create_cats_core_commodity_substitutions.rb +10 -10
  171. data/db/migrate/20220103152802_create_cats_core_tenderers.rb +6 -6
  172. data/db/migrate/20220107121752_create_cats_core_round_plans.rb +7 -7
  173. data/db/migrate/20220107122280_create_cats_core_round_rations.rb +12 -12
  174. data/db/migrate/20220107125025_create_cats_core_round_plan_items.rb +19 -19
  175. data/db/migrate/20220107126025_create_cats_core_beneficiary_round_plan_items.rb +8 -8
  176. data/db/migrate/20220107132433_create_cats_core_round_plan_item_details.rb +9 -9
  177. data/db/migrate/20220209083928_create_cats_core_hub_authorizations.rb +12 -12
  178. data/db/migrate/20220416143416_create_cats_core_unit_conversions.rb +6 -6
  179. data/db/migrate/20220417105839_create_cats_core_transport_requisitions.rb +12 -12
  180. data/db/migrate/20220417123835_create_cats_core_transport_requisition_items.rb +9 -9
  181. data/db/migrate/20220417151821_create_cats_core_transport_requisition_details.rb +6 -6
  182. data/db/migrate/20220506082329_create_cats_core_transport_orders.rb +10 -10
  183. data/db/migrate/20220506083042_create_cats_core_transport_order_items.rb +13 -13
  184. data/db/migrate/20220511082354_create_cats_core_beneficiaries.rb +6 -6
  185. data/db/migrate/20220626063501_create_cats_core_loans.rb +6 -6
  186. data/db/migrate/20220626063757_create_cats_core_swaps.rb +12 -12
  187. data/db/migrate/20220626132050_create_cats_core_round_beneficiaries.rb +13 -13
  188. data/db/migrate/20220923190857_create_cats_core_application_settings.rb +3 -3
  189. data/lib/cats/core/engine.rb +4 -4
  190. data/lib/cats/core/version.rb +1 -1
  191. data/lib/cats_core.rb +8 -8
  192. data/spec/factories/cats/core/application_modules.rb +1 -1
  193. data/spec/factories/cats/core/application_settings.rb +1 -1
  194. data/spec/factories/cats/core/beneficiaries.rb +3 -3
  195. data/spec/factories/cats/core/beneficiary_categories.rb +1 -1
  196. data/spec/factories/cats/core/beneficiary_plan_items.rb +1 -1
  197. data/spec/factories/cats/core/beneficiary_round_plan_items.rb +1 -1
  198. data/spec/factories/cats/core/cash_donations.rb +1 -1
  199. data/spec/factories/cats/core/commodities.rb +1 -1
  200. data/spec/factories/cats/core/commodity_categories.rb +1 -1
  201. data/spec/factories/cats/core/commodity_donations.rb +1 -1
  202. data/spec/factories/cats/core/commodity_substitutions.rb +2 -2
  203. data/spec/factories/cats/core/contract_items.rb +1 -1
  204. data/spec/factories/cats/core/currencies.rb +1 -1
  205. data/spec/factories/cats/core/dispatch_authorizations.rb +7 -11
  206. data/spec/factories/cats/core/dispatch_plan_items.rb +16 -1
  207. data/spec/factories/cats/core/dispatch_plans.rb +1 -1
  208. data/spec/factories/cats/core/dispatch_transactions.rb +2 -4
  209. data/spec/factories/cats/core/dispatches.rb +16 -25
  210. data/spec/factories/cats/core/donors.rb +1 -1
  211. data/spec/factories/cats/core/gift_certificates.rb +1 -1
  212. data/spec/factories/cats/core/hub_authorizations.rb +1 -1
  213. data/spec/factories/cats/core/loans.rb +1 -1
  214. data/spec/factories/cats/core/locations.rb +6 -6
  215. data/spec/factories/cats/core/lost_commodities.rb +1 -1
  216. data/spec/factories/cats/core/menu_items.rb +1 -1
  217. data/spec/factories/cats/core/menus.rb +1 -1
  218. data/spec/factories/cats/core/notification_rules.rb +1 -1
  219. data/spec/factories/cats/core/notifications.rb +2 -2
  220. data/spec/factories/cats/core/offer_items.rb +1 -1
  221. data/spec/factories/cats/core/operators.rb +1 -1
  222. data/spec/factories/cats/core/plan_item_details.rb +1 -1
  223. data/spec/factories/cats/core/plan_items.rb +1 -1
  224. data/spec/factories/cats/core/plans.rb +1 -1
  225. data/spec/factories/cats/core/programs.rb +1 -1
  226. data/spec/factories/cats/core/projects.rb +1 -1
  227. data/spec/factories/cats/core/purchase_orders.rb +1 -1
  228. data/spec/factories/cats/core/rations.rb +1 -1
  229. data/spec/factories/cats/core/receipt_authorizations.rb +1 -1
  230. data/spec/factories/cats/core/receipt_transactions.rb +2 -2
  231. data/spec/factories/cats/core/receipts.rb +1 -1
  232. data/spec/factories/cats/core/rhn_requests.rb +1 -1
  233. data/spec/factories/cats/core/role_menus.rb +1 -1
  234. data/spec/factories/cats/core/roles.rb +1 -1
  235. data/spec/factories/cats/core/round_beneficiaries.rb +1 -1
  236. data/spec/factories/cats/core/round_plan_item_details.rb +3 -3
  237. data/spec/factories/cats/core/round_plan_items.rb +1 -1
  238. data/spec/factories/cats/core/round_plans.rb +1 -1
  239. data/spec/factories/cats/core/round_rations.rb +1 -1
  240. data/spec/factories/cats/core/routes.rb +1 -1
  241. data/spec/factories/cats/core/stack_transactions.rb +1 -1
  242. data/spec/factories/cats/core/stacking_rules.rb +1 -1
  243. data/spec/factories/cats/core/stacks.rb +1 -1
  244. data/spec/factories/cats/core/stores.rb +1 -1
  245. data/spec/factories/cats/core/suppliers.rb +1 -1
  246. data/spec/factories/cats/core/swaps.rb +1 -1
  247. data/spec/factories/cats/core/tenderers.rb +1 -1
  248. data/spec/factories/cats/core/transport_bid_items.rb +1 -1
  249. data/spec/factories/cats/core/transport_bids.rb +1 -1
  250. data/spec/factories/cats/core/transport_contracts.rb +1 -1
  251. data/spec/factories/cats/core/transport_offers.rb +1 -1
  252. data/spec/factories/cats/core/transport_order_items.rb +1 -1
  253. data/spec/factories/cats/core/transport_orders.rb +1 -1
  254. data/spec/factories/cats/core/transport_plan_items.rb +1 -1
  255. data/spec/factories/cats/core/transport_plans.rb +1 -1
  256. data/spec/factories/cats/core/transport_requisition_details.rb +1 -1
  257. data/spec/factories/cats/core/transport_requisition_items.rb +1 -1
  258. data/spec/factories/cats/core/transport_requisitions.rb +1 -1
  259. data/spec/factories/cats/core/transporters.rb +1 -1
  260. data/spec/factories/cats/core/unit_conversions.rb +1 -1
  261. data/spec/factories/cats/core/unit_of_measures.rb +1 -1
  262. data/spec/factories/cats/core/users.rb +2 -2
  263. metadata +18 -2
data/config/routes.rb CHANGED
@@ -1,226 +1,231 @@
1
1
  Cats::Core::Engine.routes.draw do
2
- get 'locations/index'
3
- get 'locations/children'
4
- post '/login', controller: :access, action: :login
5
- get '/notifications/unread', controller: :notifications, action: :unread
6
- get '/notifications/read', controller: :notifications, action: :read
7
-
2
+ get "locations/index"
3
+ get "locations/children"
4
+ post "/login", controller: :access, action: :login
5
+ patch "/change_pass", controller: :users, action: :change_password
6
+ get "/notifications/unread", controller: :notifications, action: :unread
7
+ get "/notifications/read", controller: :notifications, action: :read
8
+
8
9
  resources :application_modules, param: :prefix do
9
10
  member do
10
- get 'roles', controller: :roles, action: :index
11
- get 'users', controller: :users, action: :index
11
+ get "roles", controller: :roles, action: :index
12
+ get "users", controller: :users, action: :index
12
13
  end
13
14
  end
14
15
 
15
16
  resources :menus, only: [:index]
16
17
  resources :notifications, only: [:index] do
17
18
  member do
18
- post 'mark_as_read', controller: :notifications, action: :mark_as_read
19
- post 'mark_as_unread', controller: :notifications, action: :mark_as_unread
19
+ post "mark_as_read", controller: :notifications, action: :mark_as_read
20
+ post "mark_as_unread", controller: :notifications, action: :mark_as_unread
20
21
  end
21
22
  end
22
23
 
23
- get '/roles/:id/', controller: :roles, action: :show
24
+ get "/roles/:id/", controller: :roles, action: :show
24
25
  resources :roles, param: :name do
25
26
  member do
26
- get 'users', controller: :roles, action: :users
27
+ get "users", controller: :roles, action: :users
27
28
  end
28
29
  end
29
30
  resources :users do
30
31
  member do
31
- get 'roles'
32
- get 'unassigned_roles', controller: :roles, action: :unassigned_roles
33
- get 'stores', controller: :users, action: :stores
34
- get 'warehouse', controller: :users, action: :warehouse
35
- get 'hub', controller: :users, action: :hub
36
- get 'plans', controller: :dispatch_plans, action: :plans_for_user
37
- post 'assign_role'
38
- post 'revoke_role'
32
+ get "roles"
33
+ get "unassigned_roles", controller: :roles, action: :unassigned_roles
34
+ get "stores", controller: :users, action: :stores
35
+ get "warehouse", controller: :users, action: :warehouse
36
+ get "hub", controller: :users, action: :hub
37
+ get "plans", controller: :dispatch_plans, action: :plans_for_user
38
+ post "assign_role"
39
+ post "revoke_role"
39
40
  end
40
41
  end
41
42
 
42
- get '/regions/:id/woredas', controller: :locations, action: :woredas, as: :region_woredas
43
- post '/locations/filter', controller: :locations, action: :filter
44
- post '/locations/fdp/create', controller: :locations, action: :create_fdp
43
+ get "/regions/:id/woredas", controller: :locations, action: :woredas, as: :region_woredas
44
+ post "/locations/filter", controller: :locations, action: :filter
45
+ post "/locations/fdp/create", controller: :locations, action: :create_fdp
45
46
  resources :locations, except: %i[destroy] do
46
47
  member do
47
- get 'children'
48
+ get "children"
48
49
  end
49
50
  end
50
51
 
51
- get '/hubs/:id/space',
52
- to: 'spaces#available_space',
53
- as: :hub_space,
54
- defaults: { level: Cats::Core::SpaceService::HUB }
55
- get '/warehouses/:id/space',
56
- to: 'spaces#available_space',
57
- as: :warehouse_space,
58
- defaults: { level: Cats::Core::SpaceService::WAREHOUSE }
59
- get '/warehouses/:id/stack_transactions',
60
- to: 'stack_transactions#index',
61
- as: :warehouse_stack_transactions
62
- get '/stores/:id/space',
63
- to: 'spaces#available_space',
64
- as: :store_space,
65
- defaults: { level: Cats::Core::SpaceService::STORE }
66
-
67
- get '/commodity_categories/roots', to: 'commodity_categories#root', as: :commodity_category_roots
68
- get '/commodity_categories/all', to: 'commodity_categories#all', as: :commodity_category_all
52
+ get "/hubs/:id/space",
53
+ to: "spaces#available_space",
54
+ as: :hub_space,
55
+ defaults: {level: Cats::Core::SpaceService::HUB}
56
+ get "/warehouses/:id/space",
57
+ to: "spaces#available_space",
58
+ as: :warehouse_space,
59
+ defaults: {level: Cats::Core::SpaceService::WAREHOUSE}
60
+ get "/warehouses/:id/stack_transactions",
61
+ to: "stack_transactions#index",
62
+ as: :warehouse_stack_transactions
63
+ get "/stores/:id/space",
64
+ to: "spaces#available_space",
65
+ as: :store_space,
66
+ defaults: {level: Cats::Core::SpaceService::STORE}
67
+
68
+ get "/commodity_categories/roots", to: "commodity_categories#root", as: :commodity_category_roots
69
+ get "/commodity_categories/all", to: "commodity_categories#all", as: :commodity_category_all
69
70
  resources :commodity_categories, except: %i[destroy] do
70
71
  member do
71
- get 'children'
72
+ get "children"
72
73
  end
73
74
  end
74
- post '/commodities/filter', controller: :commodities, action: :filter
75
+ post "/commodities/filter", controller: :commodities, action: :filter
75
76
  resources :commodities, except: %i[destroy] do
76
77
  member do
77
- post 'approve'
78
+ post "approve"
78
79
  end
79
80
  end
80
81
  resources :currencies, except: %i[destroy]
81
82
  resources :unit_of_measures, except: %i[destroy]
82
83
  resources :unit_conversions, except: %i[destroy]
83
84
 
84
- post '/transporters/filter', controller: :transporters, action: :filter
85
+ post "/transporters/filter", controller: :transporters, action: :filter
85
86
  resources :transporters, except: %i[destroy]
86
87
 
87
- post '/routes/filter', controller: :routes, action: :filter
88
- post '/routes/bulk_create', controller: :routes, action: :bulk_create
88
+ post "/routes/filter", controller: :routes, action: :filter
89
+ post "/routes/bulk_create", controller: :routes, action: :bulk_create
89
90
  resources :routes, except: %i[destroy]
90
91
 
91
92
  resources :commodity_donations, except: %i[destroy]
92
93
  resources :purchase_orders, except: %i[index destroy]
93
94
  resources :cash_donations, except: %i[destroy] do
94
95
  member do
95
- get 'purchase_orders', controller: :purchase_orders, action: :index
96
+ get "purchase_orders", controller: :purchase_orders, action: :index
96
97
  end
97
98
  end
98
99
  resources :swaps, except: %i[destory]
99
100
  resources :loans, except: %i[destory]
100
101
 
101
- post '/dispatch_plans/filter', controller: :dispatch_plans, action: :filter
102
- post '/dispatch_plans/bulk_create'
102
+ post "/dispatch_plans/filter", controller: :dispatch_plans, action: :filter
103
+ post "/dispatch_plans/bulk_create"
103
104
  resources :dispatch_plans do
104
105
  member do
105
- get 'items', controller: :dispatch_plan_items, action: :index
106
- post 'approve'
106
+ get "items", controller: :dispatch_plan_items, action: :index
107
+ post "approve"
107
108
  end
108
109
  end
109
110
 
110
111
  resources :dispatch_plan_items, except: %i[index destroy]
111
112
 
112
- post '/dispatch_plan_items/filter', controller: :dispatch_plan_items, action: :filter
113
- get '/dispatch_plan_items/:id/dispatches', controller: :dispatches, action: :index, as: :dispatches_plan_item
113
+ post "/dispatch_plan_items/filter", controller: :dispatch_plan_items, action: :filter
114
+ get "/dispatch_plan_items/:id/dispatches", controller: :dispatches, action: :index, as: :dispatches_plan_item
114
115
 
115
- post '/dispatches/filter', controller: :dispatches, action: :filter
116
- get '/dispatches/search', controller: :dispatches, action: :search, as: :search_dispatches
116
+ post "/dispatches/filter", controller: :dispatches, action: :filter
117
+ get "/dispatches/search", controller: :dispatches, action: :search, as: :search_dispatches
117
118
  resources :dispatches, except: %i[index destroy] do
118
119
  member do
119
- get 'dispatch_authorizations', controller: :dispatch_authorizations, action: :index
120
- get 'receipt_authorizations', controller: :receipt_authorizations, action: :index
121
- get 'receipts', controller: :receipts, action: :index
122
- get 'commodity'
123
- post 'approve'
124
- post 'start'
125
- post 'confirm'
126
- post 'start_with_pin'
120
+ get "dispatch_authorizations", controller: :dispatch_authorizations, action: :index
121
+ get "receipt_authorizations", controller: :receipt_authorizations, action: :index
122
+ get "receipts", controller: :receipts, action: :index
123
+ get "commodity"
124
+ post "approve"
125
+ post "start"
126
+ post "confirm"
127
+ post "start_with_pin"
127
128
  end
128
129
  end
129
130
 
131
+ post "/dispatch_authorizations/filter", controller: :dispatch_authorizations, action: :filter
130
132
  resources :dispatch_authorizations, except: %i[index destory] do
131
133
  member do
132
- get 'transactions', controller: :dispatch_transactions, action: :index
133
- post 'confirm', controller: :dispatch_authorizations, action: :confirm
134
+ get "transactions", controller: :dispatch_transactions, action: :index
135
+ post "confirm", controller: :dispatch_authorizations, action: :confirm
134
136
  end
135
137
  end
136
138
 
137
139
  get(
138
- '/storekeeper/:id/dispatch_authorizations',
140
+ "/storekeeper/:id/dispatch_authorizations",
139
141
  controller: :dispatch_authorizations,
140
142
  action: :storekeeper_authorizations,
141
143
  as: :storekeeper_dispatch_authorizations
142
144
  )
143
145
  get(
144
- '/storekeeper/:id/receipt_authorizations',
146
+ "/storekeeper/:id/receipt_authorizations",
145
147
  controller: :receipt_authorizations,
146
148
  action: :storekeeper_authorizations,
147
149
  as: :storekeeper_receipt_authorizations
148
150
  )
149
151
  post(
150
- '/storekeeper/:id/assign_stores',
152
+ "/storekeeper/:id/assign_stores",
151
153
  controller: :stores,
152
154
  action: :assign_store,
153
155
  as: :assign_stores_to_storekeeper
154
156
  )
155
157
  post(
156
- '/storekeeper/:id/unassign_stores',
158
+ "/storekeeper/:id/unassign_stores",
157
159
  controller: :stores,
158
160
  action: :unassign_store,
159
161
  as: :unassign_stores_to_storekeeper
160
162
  )
161
163
  post(
162
- '/receipt_authorizations/generate',
164
+ "/receipt_authorizations/generate",
163
165
  controller: :receipt_authorizations,
164
166
  action: :generate,
165
167
  as: :generate_receipt_authorizations
166
168
  )
169
+
170
+ post "/receipt_authorizations/filter", controller: :receipt_authorizations, action: :filter
171
+
167
172
  resources :receipt_authorizations, except: %i[index destroy] do
168
173
  member do
169
- get 'transactions', controller: :receipt_transactions, action: :index
170
- get 'lost', controller: :lost_commodities, action: :index
171
- get 'receipts', controller: :receipts, action: :index
172
- get 'stacks', controller: :stacks, action: :receipt_stacks
173
- post 'confirm'
174
- post 'driver_confirm'
175
- post 'stack'
174
+ get "transactions", controller: :receipt_transactions, action: :index
175
+ get "lost", controller: :lost_commodities, action: :index
176
+ get "receipts", controller: :receipts, action: :index
177
+ get "stacks", controller: :stacks, action: :receipt_stacks
178
+ post "confirm"
179
+ post "driver_confirm"
180
+ post "stack"
176
181
  end
177
182
  end
178
183
 
179
184
  resources :receipts, except: %i[index destroy]
180
185
  post(
181
- 'dispatch_transactions/allocation',
186
+ "dispatch_transactions/allocation",
182
187
  controller: :dispatch_transactions,
183
188
  action: :create_allocation,
184
189
  as: :allocation_transaction
185
190
  )
186
- post '/dispatch_transactions/filter', controller: :dispatch_transactions, action: :filter
191
+ post "/dispatch_transactions/filter", controller: :dispatch_transactions, action: :filter
187
192
  resources :dispatch_transactions, except: %i[index new edit destroy]
188
- post '/receipt_transactions/filter', controller: :receipt_transactions, action: :filter
193
+ post "/receipt_transactions/filter", controller: :receipt_transactions, action: :filter
189
194
  resources :receipt_transactions, except: %i[index new edit destroy]
190
195
  resources :stack_transactions, except: %i[index new edit destroy]
191
196
  resources :lost_commodities, except: %i[index destroy]
192
- get '/plans/:id/round_plans', controller: :round_plans, action: :index, as: :round_plans_plan
193
-
194
- post '/round_beneficiaries/filter'
197
+ get "/plans/:id/round_plans", controller: :round_plans, action: :index, as: :round_plans_plan
198
+
199
+ post "/round_beneficiaries/filter"
195
200
  resources :round_beneficiaries, only: %i[show]
196
- post '/round_plans/generate'
197
- post '/round_plans/filter'
201
+ post "/round_plans/generate"
202
+ post "/round_plans/filter"
198
203
  resources :round_plans, except: %i[index destroy] do
199
204
  member do
200
- post 'generate_dispatch_plan', controller: :dispatch_plans, action: :generate
201
- post 'remove_items'
202
- post 'remove_beneficiaries', controller: :round_beneficiaries, action: :remove_beneficiaries
203
- post 'confirm_receipt', controller: :round_beneficiaries, action: :confirm_receipt
204
- post 'generate_round_needs'
205
- post 'approve'
206
- post 'generate_distribution_list', controller: :round_beneficiaries, action: :generate
207
- get 'beneficiaries', controller: :round_beneficiaries, action: :index
205
+ post "generate_dispatch_plan", controller: :dispatch_plans, action: :generate
206
+ post "remove_items"
207
+ post "remove_beneficiaries", controller: :round_beneficiaries, action: :remove_beneficiaries
208
+ post "confirm_receipt", controller: :round_beneficiaries, action: :confirm_receipt
209
+ post "generate_round_needs"
210
+ post "approve"
211
+ post "generate_distribution_list", controller: :round_beneficiaries, action: :generate
212
+ get "beneficiaries", controller: :round_beneficiaries, action: :index
208
213
  end
209
214
  end
210
215
 
211
- get '/stores/:id/stacks', controller: :stacks, action: :index, as: :stacks_store
212
- post '/stores/:id/stacks', controller: :stacks, action: :filter
213
- get '/stacks/items_for_location', controller: :stacks, action: :items_for_location, as: :items_for_location
214
- get '/receipts/:id/stacks', controller: :stacks, action: :receipt_stacks, as: :receipt_stacks
215
- get '/dispatches/:id/stacks', controller: :stacks, action: :dispatch_stacks, as: :dispatch_stacks
216
- resources :stacks, only: %i[show index create update]
216
+ get "/stores/:id/stacks", controller: :stacks, action: :index, as: :stacks_store
217
+ post "/stores/:id/stacks", controller: :stacks, action: :filter
218
+ get "/stacks/items_for_location", controller: :stacks, action: :items_for_location, as: :items_for_location
219
+ get "/receipts/:id/stacks", controller: :stacks, action: :receipt_stacks, as: :receipt_stacks
220
+ get "/dispatches/:id/stacks", controller: :stacks, action: :dispatch_stacks, as: :dispatch_stacks
221
+ resources :stacks, only: %i[show index create update destroy]
217
222
 
218
- get '/warehouses/:id/stores', controller: :stores, action: :index, as: :stores_warehouse
219
- get '/hubs/:id/stores', controller: :stores, action: :stores_for_hub, as: :stores_hub
223
+ get "/warehouses/:id/stores", controller: :stores, action: :index, as: :stores_warehouse
224
+ get "/hubs/:id/stores", controller: :stores, action: :stores_for_hub, as: :stores_hub
220
225
  resources :stores, only: %i[index show create update] do
221
226
  member do
222
- get 'fdp'
227
+ get "fdp"
223
228
  end
224
229
  end
225
- post '/stores/filter', controller: :stores, action: :filter
230
+ post "/stores/filter", controller: :stores, action: :filter
226
231
  end
data/config/spring.rb ADDED
@@ -0,0 +1 @@
1
+ Spring.application_root = "./spec/dummy"
@@ -9,9 +9,9 @@ class CreateCatsCoreUsers < ActiveRecord::Migration[6.1]
9
9
  t.jsonb :details, null: false, default: {}
10
10
  t.string :phone_number
11
11
  t.references :application_module,
12
- null: false,
13
- index: { name: 'am_on_users_indx' },
14
- foreign_key: { to_table: :cats_core_application_modules }
12
+ null: false,
13
+ index: {name: "am_on_users_indx"},
14
+ foreign_key: {to_table: :cats_core_application_modules}
15
15
 
16
16
  t.timestamps
17
17
  end
@@ -2,27 +2,27 @@ class CreateCatsCoreRoles < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table(:cats_core_roles) do |t|
4
4
  t.string :name
5
- t.references :resource, :polymorphic => true
5
+ t.references :resource, polymorphic: true
6
6
  t.references :application_module,
7
- null: false,
8
- index: { name: 'am_on_roles_indx' },
9
- foreign_key: { to_table: :cats_core_application_modules }
7
+ null: false,
8
+ index: {name: "am_on_roles_indx"},
9
+ foreign_key: {to_table: :cats_core_application_modules}
10
10
 
11
11
  t.timestamps
12
12
  end
13
13
 
14
- create_table(:cats_core_users_cats_core_roles, :id => false) do |t|
14
+ create_table(:cats_core_users_cats_core_roles, id: false) do |t|
15
15
  t.references :user,
16
- null: false,
17
- index: { name: 'user_on_ur_indx' },
18
- foreign_key: { to_table: :cats_core_users }
16
+ null: false,
17
+ index: {name: "user_on_ur_indx"},
18
+ foreign_key: {to_table: :cats_core_users}
19
19
  t.references :role,
20
- null: false,
21
- index: { name: 'role_on_ur_indx' },
22
- foreign_key: { to_table: :cats_core_roles }
20
+ null: false,
21
+ index: {name: "role_on_ur_indx"},
22
+ foreign_key: {to_table: :cats_core_roles}
23
23
  end
24
-
25
- add_index(:cats_core_roles, [ :name, :resource_type, :resource_id ])
26
- add_index(:cats_core_users_cats_core_roles, [ :user_id, :role_id ], unique: true)
24
+
25
+ add_index(:cats_core_roles, [:name, :resource_type, :resource_id])
26
+ add_index(:cats_core_users_cats_core_roles, [:user_id, :role_id], unique: true)
27
27
  end
28
28
  end
@@ -4,9 +4,9 @@ class CreateCatsCoreMenus < ActiveRecord::Migration[6.1]
4
4
  t.string :label, null: false
5
5
  t.string :icon
6
6
  t.references :application_module,
7
- null: false,
8
- index: { name: 'am_on_menus_indx' },
9
- foreign_key: { to_table: :cats_core_application_modules }
7
+ null: false,
8
+ index: {name: "am_on_menus_indx"},
9
+ foreign_key: {to_table: :cats_core_application_modules}
10
10
 
11
11
  t.timestamps
12
12
  end
@@ -5,9 +5,9 @@ class CreateCatsCoreMenuItems < ActiveRecord::Migration[6.1]
5
5
  t.string :icon
6
6
  t.string :route, null: false
7
7
  t.references :menu,
8
- null: false,
9
- index: { name: 'menu_on_mi_indx' },
10
- foreign_key: { to_table: :cats_core_menus }
8
+ null: false,
9
+ index: {name: "menu_on_mi_indx"},
10
+ foreign_key: {to_table: :cats_core_menus}
11
11
 
12
12
  t.timestamps
13
13
  end
@@ -2,27 +2,27 @@ class CreateCatsCoreRoleMenus < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :cats_core_role_menus do |t|
4
4
  t.references :role,
5
- null: false,
6
- index: { name: 'role_on_rm_indx' },
7
- foreign_key: { to_table: :cats_core_roles }
5
+ null: false,
6
+ index: {name: "role_on_rm_indx"},
7
+ foreign_key: {to_table: :cats_core_roles}
8
8
  t.references :menu,
9
- null: false,
10
- index: { name: 'menu_on_rm_indx' },
11
- foreign_key: { to_table: :cats_core_menus }
9
+ null: false,
10
+ index: {name: "menu_on_rm_indx"},
11
+ foreign_key: {to_table: :cats_core_menus}
12
12
  t.string :description
13
13
 
14
14
  t.timestamps
15
15
  end
16
16
 
17
- create_table(:cats_core_role_menus_menu_items, :id => false) do |t|
17
+ create_table(:cats_core_role_menus_menu_items, id: false) do |t|
18
18
  t.references :role_menu,
19
- null: false,
20
- index: { name: 'rm_on_ummi_indx' },
21
- foreign_key: { to_table: :cats_core_role_menus }
19
+ null: false,
20
+ index: {name: "rm_on_ummi_indx"},
21
+ foreign_key: {to_table: :cats_core_role_menus}
22
22
  t.references :menu_item,
23
- null: false,
24
- index: { name: 'mi_on_ummi_indx' },
25
- foreign_key: { to_table: :cats_core_menu_items }
23
+ null: false,
24
+ index: {name: "mi_on_ummi_indx"},
25
+ foreign_key: {to_table: :cats_core_menu_items}
26
26
  end
27
27
  end
28
28
  end
@@ -4,15 +4,15 @@ class CreateCatsCorePlans < ActiveRecord::Migration[6.1]
4
4
  t.string :reference_no, unique: true
5
5
  t.integer :year, null: false
6
6
  t.string :season, null: false
7
- t.string :status, null: false, default: 'Draft'
7
+ t.string :status, null: false, default: "Draft"
8
8
  t.date :start_date
9
9
  t.integer :total_days, null: false, default: 180
10
10
  t.integer :rounds, null: false
11
11
 
12
12
  t.references :program,
13
- null: false,
14
- index: { name: 'program_on_plan_indx' },
15
- foreign_key: { to_table: :cats_core_programs }
13
+ null: false,
14
+ index: {name: "program_on_plan_indx"},
15
+ foreign_key: {to_table: :cats_core_programs}
16
16
 
17
17
  t.timestamps
18
18
  end
@@ -2,29 +2,29 @@ class CreateCatsCorePlanItems < ActiveRecord::Migration[6.1]
2
2
  def change
3
3
  create_table :cats_core_plan_items do |t|
4
4
  t.references :plan,
5
- null: false,
6
- index: { name: 'plan_on_plan_items_indx' },
7
- foreign_key: { to_table: :cats_core_plans }
5
+ null: false,
6
+ index: {name: "plan_on_plan_items_indx"},
7
+ foreign_key: {to_table: :cats_core_plans}
8
8
  t.references :region,
9
- null: false,
10
- index: { name: 'region_on_plan_items_indx' },
11
- foreign_key: { to_table: :cats_core_locations }
9
+ null: false,
10
+ index: {name: "region_on_plan_items_indx"},
11
+ foreign_key: {to_table: :cats_core_locations}
12
12
  t.references :zone,
13
- null: false,
14
- index: { name: 'zone_on_plan_items_indx' },
15
- foreign_key: { to_table: :cats_core_locations }
13
+ null: false,
14
+ index: {name: "zone_on_plan_items_indx"},
15
+ foreign_key: {to_table: :cats_core_locations}
16
16
  t.references :woreda,
17
- null: false,
18
- index: { name: 'woreda_on_plan_items_idnx' },
19
- foreign_key: { to_table: :cats_core_locations }
17
+ null: false,
18
+ index: {name: "woreda_on_plan_items_idnx"},
19
+ foreign_key: {to_table: :cats_core_locations}
20
20
  t.references :fdp,
21
- null: false,
22
- index: { name: 'fdp_on_plan_items_indx' },
23
- foreign_key: { to_table: :cats_core_locations }
21
+ null: false,
22
+ index: {name: "fdp_on_plan_items_indx"},
23
+ foreign_key: {to_table: :cats_core_locations}
24
24
  t.references :operator,
25
- null: false,
26
- index: { name: 'operator_on_plan_items_indx' },
27
- foreign_key: { to_table: :cats_core_operators }
25
+ null: false,
26
+ index: {name: "operator_on_plan_items_indx"},
27
+ foreign_key: {to_table: :cats_core_operators}
28
28
 
29
29
  t.timestamps
30
30
  end
@@ -4,9 +4,9 @@ class CreateCatsCoreBeneficiaryCategories < ActiveRecord::Migration[7.0]
4
4
  t.string :code, unique: true
5
5
  t.string :name, null: false
6
6
  t.references :plan,
7
- null: false,
8
- index: { name: 'plan_on_bc_indx' },
9
- foreign_key: { to_table: :cats_core_plans }
7
+ null: false,
8
+ index: {name: "plan_on_bc_indx"},
9
+ foreign_key: {to_table: :cats_core_plans}
10
10
 
11
11
  t.timestamps
12
12
  end
@@ -3,20 +3,20 @@ class CreateCatsCoreRations < ActiveRecord::Migration[6.1]
3
3
  create_table :cats_core_rations do |t|
4
4
  t.string :reference_no, unique: true
5
5
  t.references :beneficiary_category,
6
- null: false,
7
- index: { name: 'bc_on_ration_indx' },
8
- foreign_key: { to_table: :cats_core_beneficiary_categories }
6
+ null: false,
7
+ index: {name: "bc_on_ration_indx"},
8
+ foreign_key: {to_table: :cats_core_beneficiary_categories}
9
9
  t.references :commodity_category,
10
- null: false,
11
- index: { name: 'cc_on_ration_indx' },
12
- foreign_key: { to_table: :cats_core_commodity_categories }
10
+ null: false,
11
+ index: {name: "cc_on_ration_indx"},
12
+ foreign_key: {to_table: :cats_core_commodity_categories}
13
13
  t.references :unit_of_measure,
14
- null: false,
15
- index: { name: 'uom_on_ration_indx' },
16
- foreign_key: { to_table: :cats_core_unit_of_measures }
14
+ null: false,
15
+ index: {name: "uom_on_ration_indx"},
16
+ foreign_key: {to_table: :cats_core_unit_of_measures}
17
17
  t.float :quantity, null: false
18
18
  t.integer :no_of_days, null: false
19
-
19
+
20
20
  t.timestamps
21
21
  end
22
22
  end
@@ -2,13 +2,13 @@ class CreateCatsCoreBeneficiaryPlanItems < ActiveRecord::Migration[7.0]
2
2
  def change
3
3
  create_table :cats_core_beneficiary_plan_items do |t|
4
4
  t.references :plan_item,
5
- null: false,
6
- index: { name: 'pi_on_bpi_indx' },
7
- foreign_key: { to_table: :cats_core_plan_items }
5
+ null: false,
6
+ index: {name: "pi_on_bpi_indx"},
7
+ foreign_key: {to_table: :cats_core_plan_items}
8
8
  t.references :beneficiary_category,
9
- null: false,
10
- index: { name: 'bc_on_bpi_indx' },
11
- foreign_key: { to_table: :cats_core_beneficiary_categories }
9
+ null: false,
10
+ index: {name: "bc_on_bpi_indx"},
11
+ foreign_key: {to_table: :cats_core_beneficiary_categories}
12
12
  t.integer :beneficiaries, null: false
13
13
 
14
14
  t.integer :rounds
@@ -20,7 +20,7 @@ class CreateCatsCoreBeneficiaryPlanItems < ActiveRecord::Migration[7.0]
20
20
  :cats_core_beneficiary_plan_items,
21
21
  [:plan_item_id, :beneficiary_category_id],
22
22
  unique: true,
23
- name: 'pii_on_bci_uniq_indx'
23
+ name: "pii_on_bci_uniq_indx"
24
24
  )
25
25
  end
26
26
  end