spree_cm_commissioner 2.5.0.pre.pre7 → 2.5.0.pre.pre8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/test_and_build_gem.yml +1 -1
- data/.tool-versions +1 -1
- data/Gemfile.lock +1 -1
- data/app/controllers/spree/api/v2/storefront/popular_route_places_controller.rb +7 -1
- data/app/controllers/spree/api/v2/storefront/route_places_controller.rb +9 -9
- data/app/finders/spree_cm_commissioner/places/find_with_route.rb +10 -10
- data/app/finders/spree_cm_commissioner/routes/find_popular.rb +10 -14
- data/app/interactors/spree_cm_commissioner/stock/inventory_item_resetter.rb +1 -1
- data/app/jobs/spree_cm_commissioner/stock/inventory_items_adjuster_job.rb +3 -3
- data/app/models/concerns/spree_cm_commissioner/option_type_attr_type.rb +3 -15
- data/app/models/concerns/spree_cm_commissioner/order_state_machine.rb +0 -2
- data/app/models/concerns/spree_cm_commissioner/store_metadata.rb +2 -14
- data/app/models/concerns/spree_cm_commissioner/tenant_preference.rb +3 -0
- data/app/models/concerns/spree_cm_commissioner/variant_options_concern.rb +7 -1
- data/app/models/spree_cm_commissioner/guest.rb +0 -13
- data/app/models/spree_cm_commissioner/inventory_item.rb +1 -5
- data/app/models/spree_cm_commissioner/line_item_decorator.rb +1 -13
- data/app/models/spree_cm_commissioner/option_type_decorator.rb +0 -8
- data/app/models/spree_cm_commissioner/option_value_decorator.rb +0 -34
- data/app/models/spree_cm_commissioner/order_decorator.rb +0 -1
- data/app/models/spree_cm_commissioner/product_decorator.rb +2 -3
- data/app/models/spree_cm_commissioner/redis_stock/cached_inventory_items_builder.rb +2 -2
- data/app/models/spree_cm_commissioner/redis_stock/inventory_updater.rb +2 -2
- data/app/models/spree_cm_commissioner/taxon_decorator.rb +0 -1
- data/app/models/spree_cm_commissioner/taxonomy_decorator.rb +1 -13
- data/app/models/spree_cm_commissioner/variant_decorator.rb +4 -7
- data/app/models/spree_cm_commissioner/vendor_decorator.rb +0 -4
- data/app/presenters/spree/variants/{visible_options_presenter.rb → visable_options_presenter.rb} +4 -2
- data/app/request_schemas/spree_cm_commissioner/popular_route_places_request_schema.rb +12 -0
- data/app/request_schemas/spree_cm_commissioner/route_places_request_schema.rb +5 -0
- data/app/views/spree/admin/tenants/_form.html.erb +18 -0
- data/app/views/spree/admin/tenants/form/_footer.html.erb +31 -0
- data/app/views/spree/admin/tenants/form/_social.html.erb +31 -0
- data/app/views/spree/order_mailer/confirm_email.html.erb +1 -1
- data/app/views/spree_cm_commissioner/layouts/order_mailer.html.erb +1 -1
- data/app/views/spree_cm_commissioner/order_mailer/tenant/_footer.html.erb +13 -6
- data/app/views/spree_cm_commissioner/order_mailer/tenant/_support_contact.html.erb +23 -24
- data/config/locales/en.yml +0 -8
- data/config/locales/km.yml +0 -8
- data/config/routes.rb +0 -8
- data/db/migrate/20251209022924_add_contact_fields_to_cm_tenants.rb +9 -0
- data/lib/cm_app_logger.rb +3 -21
- data/lib/spree_cm_commissioner/version.rb +1 -1
- data/lib/spree_cm_commissioner.rb +7 -8
- metadata +7 -57
- data/app/controllers/spree/admin/integration_mappings_controller.rb +0 -21
- data/app/controllers/spree/admin/integration_sessions_controller.rb +0 -21
- data/app/controllers/spree/admin/integrations_controller.rb +0 -83
- data/app/controllers/spree/api/v2/storefront/event_matches_controller.rb +0 -15
- data/app/errors/spree_cm_commissioner/integrations/external_client_error.rb +0 -10
- data/app/errors/spree_cm_commissioner/integrations/sync_error.rb +0 -4
- data/app/finders/spree_cm_commissioner/events/find_matches.rb +0 -15
- data/app/helpers/spree_cm_commissioner/external_integrations_helper.rb +0 -58
- data/app/jobs/spree_cm_commissioner/integrations/base_job.rb +0 -39
- data/app/jobs/spree_cm_commissioner/integrations/polling_job.rb +0 -53
- data/app/jobs/spree_cm_commissioner/integrations/polling_scheduler_job.rb +0 -30
- data/app/jobs/spree_cm_commissioner/telegram_alerts/integration_sync_failure_job.rb +0 -17
- data/app/models/concerns/spree_cm_commissioner/integrations/integration_mappable.rb +0 -61
- data/app/models/concerns/spree_cm_commissioner/line_item_integration.rb +0 -36
- data/app/models/concerns/spree_cm_commissioner/order_integration.rb +0 -33
- data/app/models/spree_cm_commissioner/integration.rb +0 -29
- data/app/models/spree_cm_commissioner/integration_mapping.rb +0 -41
- data/app/models/spree_cm_commissioner/integration_sync_session.rb +0 -15
- data/app/models/spree_cm_commissioner/integrations/stadium_x_v1.rb +0 -37
- data/app/overrides/spree/admin/shared/sub_menu/_integrations/external_integrations.html.erb.deface +0 -6
- data/app/services/spree_cm_commissioner/integrations/base/sync_manager.rb +0 -69
- data/app/services/spree_cm_commissioner/integrations/base/sync_result.rb +0 -183
- data/app/services/spree_cm_commissioner/integrations/polling.rb +0 -70
- data/app/services/spree_cm_commissioner/integrations/polling_scheduler.rb +0 -79
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/external_client/client.rb +0 -152
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/inventory/unstock_inventory.rb +0 -83
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/polling/sync_matches.rb +0 -113
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/polling/sync_zones.rb +0 -215
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/base.rb +0 -20
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/league.rb +0 -19
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/match.rb +0 -95
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb +0 -81
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket_image.rb +0 -19
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/zone.rb +0 -90
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_manager.rb +0 -35
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/full_sync_strategy.rb +0 -38
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/incremental_sync_strategy.rb +0 -44
- data/app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/webhook_sync_strategy.rb +0 -16
- data/app/services/spree_cm_commissioner/telegram_alerts/integration_sync_failure.rb +0 -49
- data/app/views/spree/admin/integration_mappings/_integration_mappings.html.erb +0 -107
- data/app/views/spree/admin/integration_mappings/index.html.erb +0 -33
- data/app/views/spree/admin/integration_sessions/_integration_sync_sessions.html.erb +0 -116
- data/app/views/spree/admin/integration_sessions/index.html.erb +0 -42
- data/app/views/spree/admin/integrations/_form.html.erb +0 -104
- data/app/views/spree/admin/integrations/_stadium_x_v1_fields.html.erb +0 -29
- data/app/views/spree/admin/integrations/edit.html.erb +0 -45
- data/app/views/spree/admin/integrations/index.html.erb +0 -75
- data/app/views/spree/admin/integrations/new.html.erb +0 -25
- data/db/migrate/20251017094845_create_cm_integrations.rb +0 -22
- data/db/migrate/20251017101555_create_cm_integration_sync_sessions.rb +0 -68
- data/db/migrate/20251017101605_create_cm_integration_mappings.rb +0 -52
- data/lib/spree_cm_commissioner/test_helper/factories/integration_factory.rb +0 -25
- data/lib/spree_cm_commissioner/test_helper/factories/integration_mapping_factory.rb +0 -14
- data/lib/spree_cm_commissioner/test_helper/factories/integration_sync_session_factory.rb +0 -7
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spree_cm_commissioner
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.5.0.pre.
|
|
4
|
+
version: 2.5.0.pre.pre8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- You
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-12-
|
|
11
|
+
date: 2025-12-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: spree
|
|
@@ -848,9 +848,6 @@ files:
|
|
|
848
848
|
- app/controllers/spree/admin/id_cards_controller.rb
|
|
849
849
|
- app/controllers/spree/admin/import_existing_orders_controller.rb
|
|
850
850
|
- app/controllers/spree/admin/import_new_orders_controller.rb
|
|
851
|
-
- app/controllers/spree/admin/integration_mappings_controller.rb
|
|
852
|
-
- app/controllers/spree/admin/integration_sessions_controller.rb
|
|
853
|
-
- app/controllers/spree/admin/integrations_controller.rb
|
|
854
851
|
- app/controllers/spree/admin/inventory_items_controller.rb
|
|
855
852
|
- app/controllers/spree/admin/kyc_controller.rb
|
|
856
853
|
- app/controllers/spree/admin/line_items_controller.rb
|
|
@@ -946,7 +943,6 @@ files:
|
|
|
946
943
|
- app/controllers/spree/api/v2/storefront/customer_notifications_controller.rb
|
|
947
944
|
- app/controllers/spree/api/v2/storefront/dynamic_field_options_controller.rb
|
|
948
945
|
- app/controllers/spree/api/v2/storefront/dynamic_fields_controller.rb
|
|
949
|
-
- app/controllers/spree/api/v2/storefront/event_matches_controller.rb
|
|
950
946
|
- app/controllers/spree/api/v2/storefront/events_controller.rb
|
|
951
947
|
- app/controllers/spree/api/v2/storefront/google_wallet_object_tokens_controller.rb
|
|
952
948
|
- app/controllers/spree/api/v2/storefront/guest_card_classes_controller.rb
|
|
@@ -1115,8 +1111,6 @@ files:
|
|
|
1115
1111
|
- app/controllers/spree_cm_commissioner/well_known_controller.rb
|
|
1116
1112
|
- app/errors/spree_cm_commissioner/connection_error.rb
|
|
1117
1113
|
- app/errors/spree_cm_commissioner/exceeding_range_error.rb
|
|
1118
|
-
- app/errors/spree_cm_commissioner/integrations/external_client_error.rb
|
|
1119
|
-
- app/errors/spree_cm_commissioner/integrations/sync_error.rb
|
|
1120
1114
|
- app/errors/spree_cm_commissioner/payment_creation_error.rb
|
|
1121
1115
|
- app/errors/spree_cm_commissioner/payment_source_missing_error.rb
|
|
1122
1116
|
- app/errors/spree_cm_commissioner/schema_validation_error.rb
|
|
@@ -1134,7 +1128,6 @@ files:
|
|
|
1134
1128
|
- app/factory/spree_cm_commissioner/vendor_telegram_message_factory.rb
|
|
1135
1129
|
- app/finders/spree_cm_commissioner/accommodations/find.rb
|
|
1136
1130
|
- app/finders/spree_cm_commissioner/accommodations/find_variant.rb
|
|
1137
|
-
- app/finders/spree_cm_commissioner/events/find_matches.rb
|
|
1138
1131
|
- app/finders/spree_cm_commissioner/orders/find.rb
|
|
1139
1132
|
- app/finders/spree_cm_commissioner/orders/find_by_state.rb
|
|
1140
1133
|
- app/finders/spree_cm_commissioner/payment_methods/group_by_bank.rb
|
|
@@ -1156,7 +1149,6 @@ files:
|
|
|
1156
1149
|
- app/helpers/spree_cm_commissioner/admin/video_on_demand_helper.rb
|
|
1157
1150
|
- app/helpers/spree_cm_commissioner/billing/monthly_orders_helper.rb
|
|
1158
1151
|
- app/helpers/spree_cm_commissioner/billing/qrcodes_helper.rb
|
|
1159
|
-
- app/helpers/spree_cm_commissioner/external_integrations_helper.rb
|
|
1160
1152
|
- app/helpers/spree_cm_commissioner/pin_code_sender_helper.rb
|
|
1161
1153
|
- app/helpers/spree_cm_commissioner/telegram/base_helper.rb
|
|
1162
1154
|
- app/helpers/spree_cm_commissioner/transit/order_query_helper.rb
|
|
@@ -1324,9 +1316,6 @@ files:
|
|
|
1324
1316
|
- app/jobs/spree_cm_commissioner/export_csv_job.rb
|
|
1325
1317
|
- app/jobs/spree_cm_commissioner/firebase_email_fetcher_job.rb
|
|
1326
1318
|
- app/jobs/spree_cm_commissioner/import_order_job.rb
|
|
1327
|
-
- app/jobs/spree_cm_commissioner/integrations/base_job.rb
|
|
1328
|
-
- app/jobs/spree_cm_commissioner/integrations/polling_job.rb
|
|
1329
|
-
- app/jobs/spree_cm_commissioner/integrations/polling_scheduler_job.rb
|
|
1330
1319
|
- app/jobs/spree_cm_commissioner/invalidate_cache_request_job.rb
|
|
1331
1320
|
- app/jobs/spree_cm_commissioner/inventory_item_syncer_job.rb
|
|
1332
1321
|
- app/jobs/spree_cm_commissioner/option_type_variants_public_metadata_updater_job.rb
|
|
@@ -1346,7 +1335,6 @@ files:
|
|
|
1346
1335
|
- app/jobs/spree_cm_commissioner/stock/inventory_items_generator_job.rb
|
|
1347
1336
|
- app/jobs/spree_cm_commissioner/stock/permanent_inventory_items_generator_job.rb
|
|
1348
1337
|
- app/jobs/spree_cm_commissioner/subscription_order_executor_job.rb
|
|
1349
|
-
- app/jobs/spree_cm_commissioner/telegram_alerts/integration_sync_failure_job.rb
|
|
1350
1338
|
- app/jobs/spree_cm_commissioner/telegram_debug_pin_code_sender_job.rb
|
|
1351
1339
|
- app/jobs/spree_cm_commissioner/telegram_notification_sender_job.rb
|
|
1352
1340
|
- app/jobs/spree_cm_commissioner/telegram_start_message_sender_job.rb
|
|
@@ -1373,18 +1361,15 @@ files:
|
|
|
1373
1361
|
- app/models/.gitkeep
|
|
1374
1362
|
- app/models/concerns/spree_cm_commissioner/event_metadata.rb
|
|
1375
1363
|
- app/models/concerns/spree_cm_commissioner/homepage_section_bitwise.rb
|
|
1376
|
-
- app/models/concerns/spree_cm_commissioner/integrations/integration_mappable.rb
|
|
1377
1364
|
- app/models/concerns/spree_cm_commissioner/json_preference_validator.rb
|
|
1378
1365
|
- app/models/concerns/spree_cm_commissioner/kyc_bitwise.rb
|
|
1379
1366
|
- app/models/concerns/spree_cm_commissioner/line_item_durationable.rb
|
|
1380
1367
|
- app/models/concerns/spree_cm_commissioner/line_item_guests_concern.rb
|
|
1381
|
-
- app/models/concerns/spree_cm_commissioner/line_item_integration.rb
|
|
1382
1368
|
- app/models/concerns/spree_cm_commissioner/line_item_transitable.rb
|
|
1383
1369
|
- app/models/concerns/spree_cm_commissioner/line_items_filter_scope.rb
|
|
1384
1370
|
- app/models/concerns/spree_cm_commissioner/metafield.rb
|
|
1385
1371
|
- app/models/concerns/spree_cm_commissioner/option_type_attr_type.rb
|
|
1386
1372
|
- app/models/concerns/spree_cm_commissioner/option_value_attr_type.rb
|
|
1387
|
-
- app/models/concerns/spree_cm_commissioner/order_integration.rb
|
|
1388
1373
|
- app/models/concerns/spree_cm_commissioner/order_scopes.rb
|
|
1389
1374
|
- app/models/concerns/spree_cm_commissioner/order_seatable.rb
|
|
1390
1375
|
- app/models/concerns/spree_cm_commissioner/order_state_machine.rb
|
|
@@ -1474,10 +1459,6 @@ files:
|
|
|
1474
1459
|
- app/models/spree_cm_commissioner/image_methods_decorator.rb
|
|
1475
1460
|
- app/models/spree_cm_commissioner/import.rb
|
|
1476
1461
|
- app/models/spree_cm_commissioner/imports/import_order.rb
|
|
1477
|
-
- app/models/spree_cm_commissioner/integration.rb
|
|
1478
|
-
- app/models/spree_cm_commissioner/integration_mapping.rb
|
|
1479
|
-
- app/models/spree_cm_commissioner/integration_sync_session.rb
|
|
1480
|
-
- app/models/spree_cm_commissioner/integrations/stadium_x_v1.rb
|
|
1481
1462
|
- app/models/spree_cm_commissioner/inventory.rb
|
|
1482
1463
|
- app/models/spree_cm_commissioner/inventory_item.rb
|
|
1483
1464
|
- app/models/spree_cm_commissioner/invite.rb
|
|
@@ -1710,7 +1691,6 @@ files:
|
|
|
1710
1691
|
- app/overrides/spree/admin/shared/_version/deploy_tag_version_badge.html.erb.deface
|
|
1711
1692
|
- app/overrides/spree/admin/shared/sub_menu/_configuration/locations_tab.html.erb.deface
|
|
1712
1693
|
- app/overrides/spree/admin/shared/sub_menu/_configuration/menu_items.html.erb.deface
|
|
1713
|
-
- app/overrides/spree/admin/shared/sub_menu/_integrations/external_integrations.html.erb.deface
|
|
1714
1694
|
- app/overrides/spree/admin/shared/sub_menu/_integrations/telegram_bot.html.erb.deface
|
|
1715
1695
|
- app/overrides/spree/admin/shared/sub_menu/_orders/import_order.html.erb.deface
|
|
1716
1696
|
- app/overrides/spree/admin/shared/sub_menu/_organizations/tenants_tab.html.erb.deface
|
|
@@ -1770,7 +1750,7 @@ files:
|
|
|
1770
1750
|
- app/overrides/spree/admin/webhooks_subscribers/_form/rules.html.erb.deface
|
|
1771
1751
|
- app/overrides/spree/admin/webhooks_subscribers/index/table.html.erb.deface
|
|
1772
1752
|
- app/overrides/spree/layouts/admin/map_head.html.erb.deface
|
|
1773
|
-
- app/presenters/spree/variants/
|
|
1753
|
+
- app/presenters/spree/variants/visable_options_presenter.rb
|
|
1774
1754
|
- app/queries/spree_cm_commissioner/accommodation_query.rb
|
|
1775
1755
|
- app/queries/spree_cm_commissioner/dashboard_crew_event_query.rb
|
|
1776
1756
|
- app/queries/spree_cm_commissioner/event_chart_queries.rb
|
|
@@ -1791,6 +1771,7 @@ files:
|
|
|
1791
1771
|
- app/request_schemas/spree_cm_commissioner/intercity_taxi_draft_order_schema.rb
|
|
1792
1772
|
- app/request_schemas/spree_cm_commissioner/intercity_taxi_draft_order_update_schema.rb
|
|
1793
1773
|
- app/request_schemas/spree_cm_commissioner/inventory_item_schema.rb
|
|
1774
|
+
- app/request_schemas/spree_cm_commissioner/popular_route_places_request_schema.rb
|
|
1794
1775
|
- app/request_schemas/spree_cm_commissioner/profile_image_request_schema.rb
|
|
1795
1776
|
- app/request_schemas/spree_cm_commissioner/route_places_request_schema.rb
|
|
1796
1777
|
- app/request_schemas/spree_cm_commissioner/seat_layout_schema.rb
|
|
@@ -2002,24 +1983,6 @@ files:
|
|
|
2002
1983
|
- app/services/spree_cm_commissioner/imports/base_import_order_service.rb
|
|
2003
1984
|
- app/services/spree_cm_commissioner/imports/create_order_service.rb
|
|
2004
1985
|
- app/services/spree_cm_commissioner/imports/update_order_service.rb
|
|
2005
|
-
- app/services/spree_cm_commissioner/integrations/base/sync_manager.rb
|
|
2006
|
-
- app/services/spree_cm_commissioner/integrations/base/sync_result.rb
|
|
2007
|
-
- app/services/spree_cm_commissioner/integrations/polling.rb
|
|
2008
|
-
- app/services/spree_cm_commissioner/integrations/polling_scheduler.rb
|
|
2009
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/external_client/client.rb
|
|
2010
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/inventory/unstock_inventory.rb
|
|
2011
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/polling/sync_matches.rb
|
|
2012
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/polling/sync_zones.rb
|
|
2013
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/base.rb
|
|
2014
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/league.rb
|
|
2015
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/match.rb
|
|
2016
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket.rb
|
|
2017
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/ticket_image.rb
|
|
2018
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/resources/zone.rb
|
|
2019
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_manager.rb
|
|
2020
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/full_sync_strategy.rb
|
|
2021
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/incremental_sync_strategy.rb
|
|
2022
|
-
- app/services/spree_cm_commissioner/integrations/stadium_x_v1/sync_strategies/webhook_sync_strategy.rb
|
|
2023
1986
|
- app/services/spree_cm_commissioner/intercity_taxi_order/create.rb
|
|
2024
1987
|
- app/services/spree_cm_commissioner/intercity_taxi_order/update.rb
|
|
2025
1988
|
- app/services/spree_cm_commissioner/metafields/product_metadata_service.rb
|
|
@@ -2048,7 +2011,6 @@ files:
|
|
|
2048
2011
|
- app/services/spree_cm_commissioner/seats/bulk_release_on_hold_blocks.rb
|
|
2049
2012
|
- app/services/spree_cm_commissioner/seats/release_expired_blocks.rb
|
|
2050
2013
|
- app/services/spree_cm_commissioner/seeds/roles_decorator.rb
|
|
2051
|
-
- app/services/spree_cm_commissioner/telegram_alerts/integration_sync_failure.rb
|
|
2052
2014
|
- app/services/spree_cm_commissioner/transit/legs_builder_service.rb
|
|
2053
2015
|
- app/services/spree_cm_commissioner/trips/search.rb
|
|
2054
2016
|
- app/services/spree_cm_commissioner/user_authenticator.rb
|
|
@@ -2150,15 +2112,6 @@ files:
|
|
|
2150
2112
|
- app/views/spree/admin/import_new_orders/index.html.erb
|
|
2151
2113
|
- app/views/spree/admin/import_new_orders/new.html.erb
|
|
2152
2114
|
- app/views/spree/admin/import_new_orders/show.html.erb
|
|
2153
|
-
- app/views/spree/admin/integration_mappings/_integration_mappings.html.erb
|
|
2154
|
-
- app/views/spree/admin/integration_mappings/index.html.erb
|
|
2155
|
-
- app/views/spree/admin/integration_sessions/_integration_sync_sessions.html.erb
|
|
2156
|
-
- app/views/spree/admin/integration_sessions/index.html.erb
|
|
2157
|
-
- app/views/spree/admin/integrations/_form.html.erb
|
|
2158
|
-
- app/views/spree/admin/integrations/_stadium_x_v1_fields.html.erb
|
|
2159
|
-
- app/views/spree/admin/integrations/edit.html.erb
|
|
2160
|
-
- app/views/spree/admin/integrations/index.html.erb
|
|
2161
|
-
- app/views/spree/admin/integrations/new.html.erb
|
|
2162
2115
|
- app/views/spree/admin/inventory_items/show.html.erb
|
|
2163
2116
|
- app/views/spree/admin/kyc/_form.html.erb
|
|
2164
2117
|
- app/views/spree/admin/kyc/edit.html.erb
|
|
@@ -2244,6 +2197,8 @@ files:
|
|
|
2244
2197
|
- app/views/spree/admin/tenants/_form.html.erb
|
|
2245
2198
|
- app/views/spree/admin/tenants/_tabs.html.erb
|
|
2246
2199
|
- app/views/spree/admin/tenants/edit.html.erb
|
|
2200
|
+
- app/views/spree/admin/tenants/form/_footer.html.erb
|
|
2201
|
+
- app/views/spree/admin/tenants/form/_social.html.erb
|
|
2247
2202
|
- app/views/spree/admin/tenants/index.html.erb
|
|
2248
2203
|
- app/views/spree/admin/tenants/new.html.erb
|
|
2249
2204
|
- app/views/spree/admin/user_events/_events.html.erb
|
|
@@ -2941,11 +2896,9 @@ files:
|
|
|
2941
2896
|
- db/migrate/20251009033331_add_registered_by_to_spree_users.rb
|
|
2942
2897
|
- db/migrate/20251009073040_add_lock_version_to_cm_routes.rb
|
|
2943
2898
|
- db/migrate/20251009073929_add_lock_version_to_cm_vendor_routes.rb
|
|
2944
|
-
- db/migrate/20251017094845_create_cm_integrations.rb
|
|
2945
|
-
- db/migrate/20251017101555_create_cm_integration_sync_sessions.rb
|
|
2946
|
-
- db/migrate/20251017101605_create_cm_integration_mappings.rb
|
|
2947
2899
|
- db/migrate/20251113081853_add_index_to_spree_orders_updated_at.rb
|
|
2948
2900
|
- db/migrate/20251119093000_add_tenant_id_to_cm_vendor_places.rb
|
|
2901
|
+
- db/migrate/20251209022924_add_contact_fields_to_cm_tenants.rb
|
|
2949
2902
|
- docker-compose.yml
|
|
2950
2903
|
- docs/api/scoped-access-token-endpoints.md
|
|
2951
2904
|
- docs/option_types/attr_types.md
|
|
@@ -3004,9 +2957,6 @@ files:
|
|
|
3004
2957
|
- lib/spree_cm_commissioner/test_helper/factories/homepage_section_relatable_factory.rb
|
|
3005
2958
|
- lib/spree_cm_commissioner/test_helper/factories/id_card_factory.rb
|
|
3006
2959
|
- lib/spree_cm_commissioner/test_helper/factories/image_factory.rb
|
|
3007
|
-
- lib/spree_cm_commissioner/test_helper/factories/integration_factory.rb
|
|
3008
|
-
- lib/spree_cm_commissioner/test_helper/factories/integration_mapping_factory.rb
|
|
3009
|
-
- lib/spree_cm_commissioner/test_helper/factories/integration_sync_session_factory.rb
|
|
3010
2960
|
- lib/spree_cm_commissioner/test_helper/factories/inventory_item_factory.rb
|
|
3011
2961
|
- lib/spree_cm_commissioner/test_helper/factories/invite_factory.rb
|
|
3012
2962
|
- lib/spree_cm_commissioner/test_helper/factories/invite_guests_factory.rb
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Admin
|
|
3
|
-
class IntegrationMappingsController < Spree::Admin::BaseController
|
|
4
|
-
helper SpreeCmCommissioner::ExternalIntegrationsHelper
|
|
5
|
-
before_action :load_integration
|
|
6
|
-
|
|
7
|
-
def index
|
|
8
|
-
@mappings = @integration.integration_mappings
|
|
9
|
-
.order(updated_at: :desc)
|
|
10
|
-
.page(params[:page])
|
|
11
|
-
.per(params[:per_page] || 25)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def load_integration
|
|
17
|
-
@integration ||= SpreeCmCommissioner::Integration.find(params[:integration_id])
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Admin
|
|
3
|
-
class IntegrationSessionsController < Spree::Admin::BaseController
|
|
4
|
-
helper SpreeCmCommissioner::ExternalIntegrationsHelper
|
|
5
|
-
before_action :load_integration
|
|
6
|
-
|
|
7
|
-
def index
|
|
8
|
-
@sync_sessions = @integration.integration_sync_sessions
|
|
9
|
-
.order(created_at: :desc)
|
|
10
|
-
.page(params[:page])
|
|
11
|
-
.per(params[:per_page] || 25)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
private
|
|
15
|
-
|
|
16
|
-
def load_integration
|
|
17
|
-
@integration ||= SpreeCmCommissioner::Integration.find(params[:integration_id])
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
module Spree
|
|
2
|
-
module Admin
|
|
3
|
-
class IntegrationsController < Spree::Admin::ResourceController
|
|
4
|
-
helper SpreeCmCommissioner::ExternalIntegrationsHelper
|
|
5
|
-
before_action :load_form_collections, only: %i[new create edit update]
|
|
6
|
-
before_action :load_integration, only: %i[enqueue_polling]
|
|
7
|
-
|
|
8
|
-
def index
|
|
9
|
-
@integrations = model_class.all
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def enqueue_polling
|
|
13
|
-
sync_type = params[:sync_type].presence || :full
|
|
14
|
-
|
|
15
|
-
if @integration.active?
|
|
16
|
-
SpreeCmCommissioner::Integrations::PollingJob.perform_later(
|
|
17
|
-
integration_id: @integration.id,
|
|
18
|
-
sync_type: sync_type
|
|
19
|
-
)
|
|
20
|
-
flash[:success] = Spree.t('admin.integration_sync_enqueued')
|
|
21
|
-
else
|
|
22
|
-
flash[:error] = Spree.t('admin.integration_inactive')
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
redirect_to admin_integration_sessions_path(@integration)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# override
|
|
29
|
-
def model_class
|
|
30
|
-
SpreeCmCommissioner::Integration
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# override
|
|
34
|
-
def collection_url(options = {})
|
|
35
|
-
admin_integrations_url(options)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def permitted_resource_params
|
|
41
|
-
params.require(:spree_cm_commissioner_integration).permit(
|
|
42
|
-
:name,
|
|
43
|
-
:type,
|
|
44
|
-
:status,
|
|
45
|
-
:conflict_strategy,
|
|
46
|
-
:incremental_sync_interval_seconds,
|
|
47
|
-
:full_sync_interval_hours,
|
|
48
|
-
:tenant_id,
|
|
49
|
-
:vendor_id,
|
|
50
|
-
public_metadata: {},
|
|
51
|
-
private_metadata: {}
|
|
52
|
-
)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def load_integration
|
|
56
|
-
@integration ||= SpreeCmCommissioner::Integration.find(params[:id])
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def load_form_collections
|
|
60
|
-
@integration_type_options ||= integration_type_options
|
|
61
|
-
@status_options ||= enum_to_options(SpreeCmCommissioner::Integration.statuses)
|
|
62
|
-
@conflict_strategy_options ||= enum_to_options(SpreeCmCommissioner::Integration.conflict_strategies)
|
|
63
|
-
@tenants ||= SpreeCmCommissioner::Tenant.select(:id, :name).order(:name)
|
|
64
|
-
@vendors ||= Spree::Vendor.select(:id, :name).order(:name)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def enum_to_options(enum_hash)
|
|
68
|
-
enum_hash.keys.map { |key| [key.humanize, key] }
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def integration_type_options
|
|
72
|
-
files = Dir[SpreeCmCommissioner::Engine.root.join('app/models/spree_cm_commissioner/integrations/*.rb')]
|
|
73
|
-
|
|
74
|
-
return [[Spree.t(:type), 'SpreeCmCommissioner::Integration']] if files.blank?
|
|
75
|
-
|
|
76
|
-
files.map do |path|
|
|
77
|
-
class_name = "SpreeCmCommissioner::Integrations::#{File.basename(path, '.rb').camelize}"
|
|
78
|
-
[class_name, class_name]
|
|
79
|
-
end.sort_by(&:first)
|
|
80
|
-
end
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
end
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
module SpreeCmCommissioner
|
|
2
|
-
module Events
|
|
3
|
-
class FindMatches < ::Spree::BaseFinder
|
|
4
|
-
# currently, there is no way to determine if an event is a match yet.
|
|
5
|
-
# this finder returns all events that have active integration mappings (synced from external systems like StadiumX)
|
|
6
|
-
# as a temporary workaround to filter out non-match events.
|
|
7
|
-
def execute
|
|
8
|
-
scope.joins(:integration_mappings).where(
|
|
9
|
-
kind: :event,
|
|
10
|
-
integration_mappings: { status: :active }
|
|
11
|
-
).distinct
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
module SpreeCmCommissioner
|
|
2
|
-
module ExternalIntegrationsHelper
|
|
3
|
-
def integration_status_badge(status)
|
|
4
|
-
badge_class = case status.to_s
|
|
5
|
-
when 'active' then 'badge-success'
|
|
6
|
-
when 'paused' then 'badge-warning'
|
|
7
|
-
else 'badge-secondary'
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
content_tag(:span, status.to_s.humanize, class: "badge badge-pill #{badge_class}")
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def integration_conflict_strategy_badge(strategy)
|
|
14
|
-
content_tag(:span, strategy.to_s.humanize, class: 'badge badge-pill badge-secondary')
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
def integration_interval_badge(value, unit)
|
|
18
|
-
content_tag(:span, "#{value}#{unit}", class: 'badge badge-pill badge-info')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def integration_base_url_link(url)
|
|
22
|
-
if url.present?
|
|
23
|
-
link_to url, url, target: '_blank', rel: 'noopener', class: 'text-decoration-underline'
|
|
24
|
-
else
|
|
25
|
-
content_tag(:span, '—', class: 'text-muted')
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def integration_mapping_internal_link(mapping)
|
|
30
|
-
return mapping.internal_id if mapping.internal.blank?
|
|
31
|
-
|
|
32
|
-
begin
|
|
33
|
-
case mapping.internal_type
|
|
34
|
-
when 'Spree::Taxon'
|
|
35
|
-
taxon = mapping.internal
|
|
36
|
-
taxonomy_id = taxon.taxonomy_id || taxon.taxonomy&.id
|
|
37
|
-
if taxonomy_id
|
|
38
|
-
link_to mapping.internal_id,
|
|
39
|
-
edit_admin_taxonomy_taxon_path(taxonomy_id, taxon.id),
|
|
40
|
-
class: 'text-primary'
|
|
41
|
-
end
|
|
42
|
-
when 'Spree::Product'
|
|
43
|
-
link_to mapping.internal_id, edit_admin_product_path(mapping.internal), class: 'text-primary'
|
|
44
|
-
when 'Spree::Variant'
|
|
45
|
-
link_to mapping.internal_id, edit_admin_product_variant_path(mapping.internal.product_id, mapping.internal), class: 'text-primary'
|
|
46
|
-
when 'Spree::Vendor'
|
|
47
|
-
link_to mapping.internal_id, edit_admin_vendor_path(mapping.internal), class: 'text-primary'
|
|
48
|
-
else
|
|
49
|
-
# Try polymorphic route as fallback
|
|
50
|
-
link_to mapping.internal_id, [:edit, :admin, mapping.internal], class: 'text-primary'
|
|
51
|
-
end
|
|
52
|
-
rescue StandardError => e
|
|
53
|
-
Rails.logger.warn("Failed to generate link for mapping #{mapping.id}: #{e.message}")
|
|
54
|
-
mapping.internal_id
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
module SpreeCmCommissioner
|
|
2
|
-
module Integrations
|
|
3
|
-
# Base class for integration jobs
|
|
4
|
-
#
|
|
5
|
-
# Provides common error handling and alerting functionality for all integration jobs.
|
|
6
|
-
# Subclasses should implement their own perform logic and call the appropriate
|
|
7
|
-
# error handler methods.
|
|
8
|
-
class BaseJob < ApplicationJob
|
|
9
|
-
queue_as :integration
|
|
10
|
-
|
|
11
|
-
protected
|
|
12
|
-
|
|
13
|
-
# Handle error by logging and sending alert
|
|
14
|
-
# @param label [String] The error label for logging
|
|
15
|
-
# @param error [StandardError] The error that occurred
|
|
16
|
-
# @param data [Hash] Additional context data (e.g., sync_type, match_id, event_type)
|
|
17
|
-
def handle_error(label:, error:, data: {})
|
|
18
|
-
error_message = "#{error.class.name}: #{error.message}"
|
|
19
|
-
|
|
20
|
-
# Log the error with structured data
|
|
21
|
-
CmAppLogger.error(
|
|
22
|
-
label: label,
|
|
23
|
-
data: data.merge(
|
|
24
|
-
message: error_message,
|
|
25
|
-
backtrace: error.backtrace
|
|
26
|
-
)
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
# Send alert via Telegram
|
|
30
|
-
TelegramAlerts::IntegrationSyncFailureJob.perform_later(
|
|
31
|
-
error_message: error_message,
|
|
32
|
-
data: data
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
error_message
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
end
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
module SpreeCmCommissioner
|
|
2
|
-
module Integrations
|
|
3
|
-
# Job that performs the actual polling (syncing) for a specific integration
|
|
4
|
-
#
|
|
5
|
-
# This job is enqueued by PollingSchedulerJob and handles:
|
|
6
|
-
# - Full syncs: Complete refresh of all data
|
|
7
|
-
# - Incremental syncs: Fetch only recent changes
|
|
8
|
-
# - Webhook syncs: Real-time event processing (triggered externally)
|
|
9
|
-
#
|
|
10
|
-
# Each integration type (StadiumXV1, LarrytaV1, etc.) must implement
|
|
11
|
-
# a sync_manager that responds to sync_full!, sync_incremental!, and sync_webhook!
|
|
12
|
-
class PollingJob < BaseJob
|
|
13
|
-
# Perform the integration pull
|
|
14
|
-
# @param integration_id [Integer] The integration ID
|
|
15
|
-
# @param sync_type [String] The sync type: 'full', 'incremental', or 'webhook_triggered'
|
|
16
|
-
# @param event_type [String] Optional event type for webhook syncs
|
|
17
|
-
# @param event_data [Hash] Optional event data for webhook syncs
|
|
18
|
-
def perform(options)
|
|
19
|
-
integration_id = options[:integration_id]
|
|
20
|
-
sync_type = options[:sync_type]
|
|
21
|
-
event_type = options[:event_type]
|
|
22
|
-
event_data = options[:event_data]
|
|
23
|
-
integration = SpreeCmCommissioner::Integration.find(integration_id)
|
|
24
|
-
|
|
25
|
-
# integration is no longer active, skip processing.
|
|
26
|
-
return unless integration.active?
|
|
27
|
-
|
|
28
|
-
SpreeCmCommissioner::Integrations::Polling.new.call(
|
|
29
|
-
integration: integration,
|
|
30
|
-
sync_type: sync_type,
|
|
31
|
-
event_type: event_type,
|
|
32
|
-
event_data: event_data
|
|
33
|
-
)
|
|
34
|
-
rescue StandardError => e
|
|
35
|
-
handle_sync_error(e, options)
|
|
36
|
-
raise
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
private
|
|
40
|
-
|
|
41
|
-
# Handle sync errors and alert
|
|
42
|
-
# @param error [StandardError] The error that occurred
|
|
43
|
-
# @param options [Hash] The options passed to perform
|
|
44
|
-
def handle_sync_error(error, options)
|
|
45
|
-
handle_error(
|
|
46
|
-
label: 'Integrations::IntegrationPullJob#perform Sync failed',
|
|
47
|
-
error: error,
|
|
48
|
-
data: options
|
|
49
|
-
)
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
53
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
module SpreeCmCommissioner
|
|
2
|
-
module Integrations
|
|
3
|
-
# Scheduler job that runs periodically to enqueue integration polling jobs
|
|
4
|
-
#
|
|
5
|
-
# This job is responsible for:
|
|
6
|
-
# - Running full syncs every 24 hours
|
|
7
|
-
# - Running incremental syncs every 10 seconds
|
|
8
|
-
# - Webhook syncs are triggered externally (not scheduled here)
|
|
9
|
-
#
|
|
10
|
-
# The job queries all active integrations and enqueues appropriate pull jobs
|
|
11
|
-
# based on their last sync time and sync type configuration.
|
|
12
|
-
class PollingSchedulerJob < BaseJob
|
|
13
|
-
def perform
|
|
14
|
-
SpreeCmCommissioner::Integrations::PollingScheduler.new.call
|
|
15
|
-
rescue StandardError => e
|
|
16
|
-
handle_scheduler_error(e)
|
|
17
|
-
raise
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
private
|
|
21
|
-
|
|
22
|
-
def handle_scheduler_error(error)
|
|
23
|
-
handle_error(
|
|
24
|
-
label: 'Integrations::PollingSchedulerJob#perform Error scheduling integration pulls',
|
|
25
|
-
error: error
|
|
26
|
-
)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
module SpreeCmCommissioner
|
|
2
|
-
module TelegramAlerts
|
|
3
|
-
class IntegrationSyncFailureJob < ApplicationJob
|
|
4
|
-
queue_as :telegram_bot
|
|
5
|
-
|
|
6
|
-
# Handle error by logging and sending alert
|
|
7
|
-
# @param error_message [String] The error message
|
|
8
|
-
# @param data [Hash] Additional context data (e.g., sync_type, match_id, event_type)
|
|
9
|
-
def perform(options)
|
|
10
|
-
SpreeCmCommissioner::TelegramAlerts::IntegrationSyncFailure.call(
|
|
11
|
-
error_message: options[:error_message],
|
|
12
|
-
data: options[:data] || {}
|
|
13
|
-
)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
module SpreeCmCommissioner
|
|
2
|
-
module Integrations
|
|
3
|
-
# IntegrationMappable provides a polymorphic mapping layer between internal records and external integration IDs.
|
|
4
|
-
#
|
|
5
|
-
# Design Rationale: Why use a separate mapping table instead of adding external_id columns directly?
|
|
6
|
-
#
|
|
7
|
-
# 1. **No Schema Changes Required**: Adding a new integration doesn't require migrations to add columns to every table.
|
|
8
|
-
# The mapping table is reusable across all models that include this concern.
|
|
9
|
-
#
|
|
10
|
-
# 2. **Polymorphic Scalability**: A single mapping table handles multiple record types (Spree::Product, Spree::Taxon,
|
|
11
|
-
# SeatLayout, etc.) without duplicating external_id columns across the schema.
|
|
12
|
-
#
|
|
13
|
-
# 3. **Multiple Source Support**: Records can have mappings to multiple integrations simultaneously. A single product
|
|
14
|
-
# might be synced from StadiumXV1, LarrytaV1, and other sources. Direct columns would require one per integration.
|
|
15
|
-
#
|
|
16
|
-
# 4. **Acceptable Performance Trade-off**: While joins are slightly slower than direct column lookups, the performance
|
|
17
|
-
# impact is negligible in practice because:
|
|
18
|
-
# - Lookups occur primarily during background jobs (async, not blocking user requests)
|
|
19
|
-
# - Integration sync operations (incremental, full, webhook)
|
|
20
|
-
# - Occasional user-triggered operations (not on every page load)
|
|
21
|
-
# The flexibility and maintainability gains far outweigh the minimal performance cost.
|
|
22
|
-
module IntegrationMappable
|
|
23
|
-
extend ActiveSupport::Concern
|
|
24
|
-
|
|
25
|
-
included do
|
|
26
|
-
has_many :integration_mappings, as: :internal, class_name: 'SpreeCmCommissioner::IntegrationMapping', dependent: :destroy
|
|
27
|
-
has_many :external_wins_integration_mappings, lambda {
|
|
28
|
-
joins(:integration).where(integration: { conflict_strategy: :external_wins })
|
|
29
|
-
}, as: :internal, class_name: 'SpreeCmCommissioner::IntegrationMapping'
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
class_methods do
|
|
33
|
-
def find_or_initialize_integration_mapping(integration_id:, external_id:)
|
|
34
|
-
IntegrationMapping.includes(:internal).find_or_initialize_by(
|
|
35
|
-
integration_id: integration_id,
|
|
36
|
-
internal_type: name,
|
|
37
|
-
external_id: external_id
|
|
38
|
-
) do |mapping|
|
|
39
|
-
mapping.internal = new
|
|
40
|
-
mapping.external_id = external_id
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def find_integration_mapping(integration_id:, external_id:)
|
|
45
|
-
IntegrationMapping.includes(:internal).find_by(
|
|
46
|
-
integration_id: integration_id,
|
|
47
|
-
internal_type: name,
|
|
48
|
-
external_id: external_id
|
|
49
|
-
)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
def find_oldest_active_mapping(integration_id:)
|
|
53
|
-
IntegrationMapping.where(
|
|
54
|
-
integration_id: integration_id,
|
|
55
|
-
internal_type: name
|
|
56
|
-
).active.order(:last_synced_at).first
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|