dmart 1.4.35__py3-none-any.whl → 1.4.37__py3-none-any.whl
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.
- dmart/__init__.py +7 -0
- dmart/alembic/README +1 -0
- dmart/alembic/notes.txt +11 -0
- dmart/alembic/script.py.mako +28 -0
- dmart/alembic.ini +117 -0
- dmart/config.env.sample +27 -0
- dmart/conftest.py +13 -0
- dmart/curl.sh +196 -0
- cxb/assets/EntryRenderer-25YDhRen.js → dmart/cxb/assets/EntryRenderer-DwSsr_qX.js +1 -1
- cxb/assets/ListView-BpAycA2h.js → dmart/cxb/assets/ListView-DDE5x83t.js +1 -1
- cxb/assets/_module-CEW0D5oI.js → dmart/cxb/assets/_module-BNXXWMkB.js +1 -1
- cxb/assets/_module-Bfk8MiCs.js → dmart/cxb/assets/_module-_Y_1Ib3l.js +1 -1
- cxb/assets/index-CTxJ-lDp.js → dmart/cxb/assets/index-Br_OAS0Q.js +1 -1
- cxb/assets/index-iYkH7C67.js → dmart/cxb/assets/index-DwORvtKk.js +1 -1
- cxb/assets/index-Cd-F5j_k.js → dmart/cxb/assets/index-NksiCXM3.js +1 -1
- cxb/assets/index-C6cPO4op.js → dmart/cxb/assets/index-WkeaPz7c.js +1 -1
- cxb/assets/index-ac-Buu_H.js → dmart/cxb/assets/index-ZWZ_PIBi.js +2 -2
- cxb/assets/index-D742rwaM.js → dmart/cxb/assets/index-skKdyGa2.js +1 -1
- {cxb → dmart/cxb}/index.html +1 -1
- dmart.py → dmart/dmart.py +4 -7
- dmart/hypercorn_config.toml +3 -0
- dmart/info.json +1 -0
- dmart/login_creds.sh +7 -0
- dmart/login_creds.sh.sample +7 -0
- dmart/manifest.sh +12 -0
- dmart/plugins/action_log/config.json +13 -0
- dmart/plugins/admin_notification_sender/config.json +13 -0
- dmart/plugins/ldap_manager/config.json +12 -0
- dmart/plugins/ldap_manager/dmart.schema +146 -0
- dmart/plugins/ldap_manager/slapd.conf +53 -0
- dmart/plugins/local_notification/config.json +13 -0
- dmart/plugins/realtime_updates_notifier/config.json +12 -0
- dmart/plugins/redis_db_update/config.json +13 -0
- dmart/plugins/resource_folders_creation/config.json +12 -0
- dmart/plugins/system_notification_sender/config.json +13 -0
- dmart/plugins/update_access_controls/config.json +12 -0
- dmart/publish.sh +57 -0
- dmart/pylint.sh +16 -0
- dmart/pyrightconfig.json +7 -0
- dmart/redis_connections.sh +13 -0
- dmart/reload.sh +56 -0
- dmart/run.sh +3 -0
- dmart/test_utils.py +34 -0
- {utils → dmart/utils}/settings.py +50 -5
- {dmart-1.4.35.dist-info → dmart-1.4.37.dist-info}/METADATA +1 -1
- dmart-1.4.37.dist-info/RECORD +285 -0
- dmart-1.4.37.dist-info/entry_points.txt +2 -0
- dmart-1.4.37.dist-info/top_level.txt +1 -0
- dmart-1.4.35.dist-info/RECORD +0 -264
- dmart-1.4.35.dist-info/entry_points.txt +0 -2
- dmart-1.4.35.dist-info/top_level.txt +0 -24
- pytests/api_user_models_erros_test.py +0 -16
- pytests/api_user_models_requests_test.py +0 -98
- pytests/archive_test.py +0 -72
- pytests/base_test.py +0 -300
- pytests/get_settings_test.py +0 -14
- pytests/json_to_db_migration_test.py +0 -237
- pytests/service_test.py +0 -26
- pytests/test_info.py +0 -55
- pytests/test_status.py +0 -15
- utils/__init__.py +0 -0
- {alembic → dmart/alembic}/__init__.py +0 -0
- {alembic → dmart/alembic}/env.py +0 -0
- {alembic → dmart/alembic}/scripts/__init__.py +0 -0
- {alembic → dmart/alembic}/scripts/calculate_checksums.py +0 -0
- {alembic → dmart/alembic}/scripts/migration_f7a4949eed19.py +0 -0
- {alembic → dmart/alembic}/versions/0f3d2b1a7c21_add_authz_materialized_views.py +0 -0
- {alembic → dmart/alembic}/versions/10d2041b94d4_last_checksum_history.py +0 -0
- {alembic → dmart/alembic}/versions/1cf4e1ee3cb8_ext_permission_with_filter_fields_values.py +0 -0
- {alembic → dmart/alembic}/versions/26bfe19b49d4_rm_failedloginattempts.py +0 -0
- {alembic → dmart/alembic}/versions/3c8bca2219cc_add_otp_table.py +0 -0
- {alembic → dmart/alembic}/versions/6675fd9dfe42_remove_unique_from_sessions_table.py +0 -0
- {alembic → dmart/alembic}/versions/71bc1df82e6a_adding_user_last_login_at.py +0 -0
- {alembic → dmart/alembic}/versions/74288ccbd3b5_initial.py +0 -0
- {alembic → dmart/alembic}/versions/7520a89a8467_rm_activesession_table.py +0 -0
- {alembic → dmart/alembic}/versions/848b623755a4_make_created_nd_updated_at_required.py +0 -0
- {alembic → dmart/alembic}/versions/8640dcbebf85_add_notes_to_users.py +0 -0
- {alembic → dmart/alembic}/versions/91c94250232a_adding_fk_on_owner_shortname.py +0 -0
- {alembic → dmart/alembic}/versions/98ecd6f56f9a_ext_meta_with_owner_group_shortname.py +0 -0
- {alembic → dmart/alembic}/versions/9aae9138c4ef_indexing_created_at_updated_at.py +0 -0
- {alembic → dmart/alembic}/versions/__init__.py +0 -0
- {alembic → dmart/alembic}/versions/b53f916b3f6d_json_to_jsonb.py +0 -0
- {alembic → dmart/alembic}/versions/eb5f1ec65156_adding_user_locked_to_device.py +0 -0
- {alembic → dmart/alembic}/versions/f7a4949eed19_adding_query_policies_to_meta.py +0 -0
- {api → dmart/api}/__init__.py +0 -0
- {api → dmart/api}/info/__init__.py +0 -0
- {api → dmart/api}/info/router.py +0 -0
- {api → dmart/api}/managed/__init__.py +0 -0
- {api → dmart/api}/managed/router.py +0 -0
- {api → dmart/api}/managed/utils.py +0 -0
- {api → dmart/api}/public/__init__.py +0 -0
- {api → dmart/api}/public/router.py +0 -0
- {api → dmart/api}/qr/__init__.py +0 -0
- {api → dmart/api}/qr/router.py +0 -0
- {api → dmart/api}/user/__init__.py +0 -0
- {api → dmart/api}/user/model/__init__.py +0 -0
- {api → dmart/api}/user/model/errors.py +0 -0
- {api → dmart/api}/user/model/requests.py +0 -0
- {api → dmart/api}/user/model/responses.py +0 -0
- {api → dmart/api}/user/router.py +0 -0
- {api → dmart/api}/user/service.py +0 -0
- /bundler.py → /dmart/bundler.py +0 -0
- {config → dmart/config}/__init__.py +0 -0
- {config → dmart/config}/channels.json +0 -0
- {config → dmart/config}/notification.json +0 -0
- {cxb → dmart/cxb}/__init__.py +0 -0
- {cxb → dmart/cxb}/assets/@codemirror-Rn7_6DkE.js +0 -0
- {cxb → dmart/cxb}/assets/@edraj-CS4NwVbD.js +0 -0
- {cxb → dmart/cxb}/assets/@floating-ui-BwwcF-xh.js +0 -0
- {cxb → dmart/cxb}/assets/@formatjs-yKEsAtjs.js +0 -0
- {cxb → dmart/cxb}/assets/@fortawesome-DRW1UCdr.js +0 -0
- {cxb → dmart/cxb}/assets/@jsonquerylang-laKNoFFq.js +0 -0
- {cxb → dmart/cxb}/assets/@lezer-za4Q-8Ew.js +0 -0
- {cxb → dmart/cxb}/assets/@marijn-DXwl3gUT.js +0 -0
- {cxb → dmart/cxb}/assets/@popperjs-l0sNRNKZ.js +0 -0
- {cxb → dmart/cxb}/assets/@replit--ERk53eB.js +0 -0
- {cxb → dmart/cxb}/assets/@roxi-CGMFK4i8.js +0 -0
- {cxb → dmart/cxb}/assets/@typewriter-cCzskkIv.js +0 -0
- {cxb → dmart/cxb}/assets/@zerodevx-BlBZjKxu.js +0 -0
- {cxb → dmart/cxb}/assets/@zerodevx-CVEpe6WZ.css +0 -0
- {cxb → dmart/cxb}/assets/BreadCrumbLite-DAhOx38v.js +0 -0
- {cxb → dmart/cxb}/assets/EntryRenderer-DXytdFp9.css +0 -0
- {cxb → dmart/cxb}/assets/ListView-U8of-_c-.css +0 -0
- {cxb → dmart/cxb}/assets/Prism--hMplq-p.js +0 -0
- {cxb → dmart/cxb}/assets/Prism-Uh6uStUw.css +0 -0
- {cxb → dmart/cxb}/assets/Table2Cols-BsbwicQm.js +0 -0
- {cxb → dmart/cxb}/assets/_..-BvT6vdHa.css +0 -0
- {cxb → dmart/cxb}/assets/_...404_-fuLH_rX9.js +0 -0
- {cxb → dmart/cxb}/assets/_...fallback_-Ba_NLmAE.js +0 -0
- {cxb → dmart/cxb}/assets/_module-Dgq0ZVtz.js +0 -0
- {cxb → dmart/cxb}/assets/ajv-Cpj98o6Y.js +0 -0
- {cxb → dmart/cxb}/assets/axios-CG2WSiiR.js +0 -0
- {cxb → dmart/cxb}/assets/clsx-B-dksMZM.js +0 -0
- {cxb → dmart/cxb}/assets/codemirror-wrapped-line-indent-DPhKvljI.js +0 -0
- {cxb → dmart/cxb}/assets/compare-C3AjiGFR.js +0 -0
- {cxb → dmart/cxb}/assets/compute-scroll-into-view-Bl8rNFhg.js +0 -0
- {cxb → dmart/cxb}/assets/consolite-DlCuI0F9.js +0 -0
- {cxb → dmart/cxb}/assets/crelt-C8TCjufn.js +0 -0
- {cxb → dmart/cxb}/assets/date-fns-l0sNRNKZ.js +0 -0
- {cxb → dmart/cxb}/assets/deepmerge-rn4rBaHU.js +0 -0
- {cxb → dmart/cxb}/assets/dmart_services-AL6-IdDE.js +0 -0
- {cxb → dmart/cxb}/assets/downloadFile-D08i0YDh.js +0 -0
- {cxb → dmart/cxb}/assets/easy-signal-BiPFIK3O.js +0 -0
- {cxb → dmart/cxb}/assets/esm-env-rsSWfq8L.js +0 -0
- {cxb → dmart/cxb}/assets/export-OF_rTiXu.js +0 -0
- {cxb → dmart/cxb}/assets/fast-deep-equal-l0sNRNKZ.js +0 -0
- {cxb → dmart/cxb}/assets/fast-diff-C-IidNf4.js +0 -0
- {cxb → dmart/cxb}/assets/fast-uri-l0sNRNKZ.js +0 -0
- {cxb → dmart/cxb}/assets/flowbite-svelte-BLvjb-sa.js +0 -0
- {cxb → dmart/cxb}/assets/flowbite-svelte-CD54FDqW.css +0 -0
- {cxb → dmart/cxb}/assets/flowbite-svelte-icons-BI8GVhw_.js +0 -0
- {cxb → dmart/cxb}/assets/github-slugger-CQ4oX9Ud.js +0 -0
- {cxb → dmart/cxb}/assets/global-igKv-1g9.js +0 -0
- {cxb → dmart/cxb}/assets/hookar-BMRD9G9H.js +0 -0
- {cxb → dmart/cxb}/assets/immutable-json-patch-DtRO2E_S.js +0 -0
- {cxb → dmart/cxb}/assets/import-1vE3gBat.js +0 -0
- {cxb → dmart/cxb}/assets/index-B-eTh-ZX.js +0 -0
- {cxb → dmart/cxb}/assets/index-BVyxzKtH.js +0 -0
- {cxb → dmart/cxb}/assets/index-BdeNM69f.js +0 -0
- {cxb → dmart/cxb}/assets/index-CC-A1ipE.js +0 -0
- {cxb → dmart/cxb}/assets/index-DTfhnhwd.js +0 -0
- {cxb → dmart/cxb}/assets/index-DdXRK7n9.js +0 -0
- {cxb → dmart/cxb}/assets/index-DtiCmB4o.js +0 -0
- {cxb → dmart/cxb}/assets/index-NBrXBlLA.css +0 -0
- {cxb → dmart/cxb}/assets/info-B986lRiM.js +0 -0
- {cxb → dmart/cxb}/assets/intl-messageformat-Dc5UU-HB.js +0 -0
- {cxb → dmart/cxb}/assets/jmespath-l0sNRNKZ.js +0 -0
- {cxb → dmart/cxb}/assets/json-schema-traverse-l0sNRNKZ.js +0 -0
- {cxb → dmart/cxb}/assets/json-source-map-DRgZidqy.js +0 -0
- {cxb → dmart/cxb}/assets/jsonpath-plus-l0sNRNKZ.js +0 -0
- {cxb → dmart/cxb}/assets/jsonrepair-B30Dx381.js +0 -0
- {cxb → dmart/cxb}/assets/lodash-es-DZVAA2ox.js +0 -0
- {cxb → dmart/cxb}/assets/marked-DKjyhwJX.js +0 -0
- {cxb → dmart/cxb}/assets/marked-gfm-heading-id-U5zO829x.js +0 -0
- {cxb → dmart/cxb}/assets/marked-mangle-CDMeiHC6.js +0 -0
- {cxb → dmart/cxb}/assets/memoize-one-BdPwpGay.js +0 -0
- {cxb → dmart/cxb}/assets/natural-compare-lite-Bg2Xcf-o.js +0 -0
- {cxb → dmart/cxb}/assets/pagination-svelte-D5CyoiE_.js +0 -0
- {cxb → dmart/cxb}/assets/pagination-svelte-v10nAbbM.css +0 -0
- {cxb → dmart/cxb}/assets/plantuml-encoder-C47mzt9T.js +0 -0
- {cxb → dmart/cxb}/assets/prismjs-DTUiLGJu.js +0 -0
- {cxb → dmart/cxb}/assets/profile-BUf-tKMe.js +0 -0
- {cxb → dmart/cxb}/assets/query-CNmXTsgf.js +0 -0
- {cxb → dmart/cxb}/assets/queryHelpers-C9iBWwqe.js +0 -0
- {cxb → dmart/cxb}/assets/scroll-into-view-if-needed-KR58zyjF.js +0 -0
- {cxb → dmart/cxb}/assets/spaces-0oyGvpii.js +0 -0
- {cxb → dmart/cxb}/assets/style-mod-Bs6eFhZE.js +0 -0
- {cxb → dmart/cxb}/assets/svelte-B2XmcTi_.js +0 -0
- {cxb → dmart/cxb}/assets/svelte-awesome-COLlx0DN.css +0 -0
- {cxb → dmart/cxb}/assets/svelte-awesome-DhnMA6Q_.js +0 -0
- {cxb → dmart/cxb}/assets/svelte-datatables-net-CY7LBj6I.js +0 -0
- {cxb → dmart/cxb}/assets/svelte-floating-ui-BlS3sOAQ.js +0 -0
- {cxb → dmart/cxb}/assets/svelte-i18n-CT2KkQaN.js +0 -0
- {cxb → dmart/cxb}/assets/svelte-jsoneditor-BzfX6Usi.css +0 -0
- {cxb → dmart/cxb}/assets/svelte-jsoneditor-CUGSvWId.js +0 -0
- {cxb → dmart/cxb}/assets/svelte-select-CegQKzqH.css +0 -0
- {cxb → dmart/cxb}/assets/svelte-select-CjHAt_85.js +0 -0
- {cxb → dmart/cxb}/assets/tailwind-merge-CJvxXMcu.js +0 -0
- {cxb → dmart/cxb}/assets/tailwind-variants-Cj20BoQ3.js +0 -0
- {cxb → dmart/cxb}/assets/toast-B9WDyfyI.js +0 -0
- {cxb → dmart/cxb}/assets/tslib-pJfR_DrR.js +0 -0
- {cxb → dmart/cxb}/assets/typewriter-editor-DkTVIJdm.js +0 -0
- {cxb → dmart/cxb}/assets/user-DeK_NB5v.js +0 -0
- {cxb → dmart/cxb}/assets/vanilla-picker-l5rcX3cq.js +0 -0
- {cxb → dmart/cxb}/assets/w3c-keyname-Vcq4gwWv.js +0 -0
- {cxb → dmart/cxb}/config.json +0 -0
- {cxb → dmart/cxb}/config.sample.json +0 -0
- {cxb → dmart/cxb}/favicon.ico +0 -0
- {cxb → dmart/cxb}/favicon.png +0 -0
- {data_adapters → dmart/data_adapters}/__init__.py +0 -0
- {data_adapters → dmart/data_adapters}/adapter.py +0 -0
- {data_adapters → dmart/data_adapters}/base_data_adapter.py +0 -0
- {data_adapters → dmart/data_adapters}/file/__init__.py +0 -0
- {data_adapters → dmart/data_adapters}/file/adapter.py +0 -0
- {data_adapters → dmart/data_adapters}/file/adapter_helpers.py +0 -0
- {data_adapters → dmart/data_adapters}/file/archive.py +0 -0
- {data_adapters → dmart/data_adapters}/file/create_index.py +0 -0
- {data_adapters → dmart/data_adapters}/file/create_users_folders.py +0 -0
- {data_adapters → dmart/data_adapters}/file/custom_validations.py +0 -0
- {data_adapters → dmart/data_adapters}/file/drop_index.py +0 -0
- {data_adapters → dmart/data_adapters}/file/health_check.py +0 -0
- {data_adapters → dmart/data_adapters}/file/redis_services.py +0 -0
- {data_adapters → dmart/data_adapters}/helpers.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/__init__.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/adapter.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/adapter_helpers.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/create_tables.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/create_users_folders.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/db_to_json_migration.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/health_check_sql.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/json_to_db_migration.py +0 -0
- {data_adapters → dmart/data_adapters}/sql/update_query_policies.py +0 -0
- /data_generator.py → /dmart/data_generator.py +0 -0
- /get_settings.py → /dmart/get_settings.py +0 -0
- {languages → dmart/languages}/__init__.py +0 -0
- {languages → dmart/languages}/arabic.json +0 -0
- {languages → dmart/languages}/english.json +0 -0
- {languages → dmart/languages}/kurdish.json +0 -0
- {languages → dmart/languages}/loader.py +0 -0
- /main.py → /dmart/main.py +0 -0
- /migrate.py → /dmart/migrate.py +0 -0
- {models → dmart/models}/__init__.py +0 -0
- {models → dmart/models}/api.py +0 -0
- {models → dmart/models}/core.py +0 -0
- {models → dmart/models}/enums.py +0 -0
- /password_gen.py → /dmart/password_gen.py +0 -0
- {plugins → dmart/plugins}/__init__.py +0 -0
- {plugins → dmart/plugins}/action_log/__init__.py +0 -0
- {plugins → dmart/plugins}/action_log/plugin.py +0 -0
- {plugins → dmart/plugins}/admin_notification_sender/__init__.py +0 -0
- {plugins → dmart/plugins}/admin_notification_sender/plugin.py +0 -0
- {plugins → dmart/plugins}/ldap_manager/__init__.py +0 -0
- {plugins → dmart/plugins}/ldap_manager/plugin.py +0 -0
- {plugins → dmart/plugins}/local_notification/__init__.py +0 -0
- {plugins → dmart/plugins}/local_notification/plugin.py +0 -0
- {plugins → dmart/plugins}/realtime_updates_notifier/__init__.py +0 -0
- {plugins → dmart/plugins}/realtime_updates_notifier/plugin.py +0 -0
- {plugins → dmart/plugins}/redis_db_update/__init__.py +0 -0
- {plugins → dmart/plugins}/redis_db_update/plugin.py +0 -0
- {plugins → dmart/plugins}/resource_folders_creation/__init__.py +0 -0
- {plugins → dmart/plugins}/resource_folders_creation/plugin.py +0 -0
- {plugins → dmart/plugins}/system_notification_sender/__init__.py +0 -0
- {plugins → dmart/plugins}/system_notification_sender/plugin.py +0 -0
- {plugins → dmart/plugins}/update_access_controls/__init__.py +0 -0
- {plugins → dmart/plugins}/update_access_controls/plugin.py +0 -0
- /run_notification_campaign.py → /dmart/run_notification_campaign.py +0 -0
- /scheduled_notification_handler.py → /dmart/scheduled_notification_handler.py +0 -0
- /schema_migration.py → /dmart/schema_migration.py +0 -0
- /schema_modulate.py → /dmart/schema_modulate.py +0 -0
- /set_admin_passwd.py → /dmart/set_admin_passwd.py +0 -0
- /sync.py → /dmart/sync.py +0 -0
- {pytests → dmart/utils}/__init__.py +0 -0
- {utils → dmart/utils}/access_control.py +0 -0
- {utils → dmart/utils}/async_request.py +0 -0
- {utils → dmart/utils}/exporter.py +0 -0
- {utils → dmart/utils}/firebase_notifier.py +0 -0
- {utils → dmart/utils}/generate_email.py +0 -0
- {utils → dmart/utils}/helpers.py +0 -0
- {utils → dmart/utils}/hypercorn_config.py +0 -0
- {utils → dmart/utils}/internal_error_code.py +0 -0
- {utils → dmart/utils}/jwt.py +0 -0
- {utils → dmart/utils}/logger.py +0 -0
- {utils → dmart/utils}/middleware.py +0 -0
- {utils → dmart/utils}/notification.py +0 -0
- {utils → dmart/utils}/password_hashing.py +0 -0
- {utils → dmart/utils}/plugin_manager.py +0 -0
- {utils → dmart/utils}/query_policies_helper.py +0 -0
- {utils → dmart/utils}/regex.py +0 -0
- {utils → dmart/utils}/repository.py +0 -0
- {utils → dmart/utils}/router_helper.py +0 -0
- {utils → dmart/utils}/sms_notifier.py +0 -0
- {utils → dmart/utils}/social_sso.py +0 -0
- {utils → dmart/utils}/templates/activation.html.j2 +0 -0
- {utils → dmart/utils}/templates/reminder.html.j2 +0 -0
- {utils → dmart/utils}/ticket_sys_utils.py +0 -0
- {utils → dmart/utils}/web_notifier.py +0 -0
- /websocket.py → /dmart/websocket.py +0 -0
- {dmart-1.4.35.dist-info → dmart-1.4.37.dist-info}/WHEEL +0 -0
dmart/__init__.py
ADDED
dmart/alembic/README
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Generic single-database configuration.
|
dmart/alembic/notes.txt
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# 1st : Make sure in alembic.ini to have proper db config for sqlalchemy.url
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# To establish the base for a previously created database run the following
|
|
5
|
+
|
|
6
|
+
CREATE TABLE alembic_version (
|
|
7
|
+
version_num VARCHAR(32) NOT NULL,
|
|
8
|
+
CONSTRAINT alembic_version_pkc PRIMARY KEY (version_num)
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
INSERT INTO alembic_version (version_num) VALUES ('74288ccbd3b5') RETURNING alembic_version.version_num;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""${message}
|
|
2
|
+
|
|
3
|
+
Revision ID: ${up_revision}
|
|
4
|
+
Revises: ${down_revision | comma,n}
|
|
5
|
+
Create Date: ${create_date}
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
from typing import Sequence, Union
|
|
9
|
+
|
|
10
|
+
from alembic import op
|
|
11
|
+
import sqlalchemy as sa
|
|
12
|
+
import sqlmodel
|
|
13
|
+
import sqlmodel.sql.sqltypes
|
|
14
|
+
${imports if imports else ""}
|
|
15
|
+
|
|
16
|
+
# revision identifiers, used by Alembic.
|
|
17
|
+
revision: str = ${repr(up_revision)}
|
|
18
|
+
down_revision: Union[str, None] = ${repr(down_revision)}
|
|
19
|
+
branch_labels: Union[str, Sequence[str], None] = ${repr(branch_labels)}
|
|
20
|
+
depends_on: Union[str, Sequence[str], None] = ${repr(depends_on)}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def upgrade() -> None:
|
|
24
|
+
${upgrades if upgrades else "pass"}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def downgrade() -> None:
|
|
28
|
+
${downgrades if downgrades else "pass"}
|
dmart/alembic.ini
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# A generic, single database configuration.
|
|
2
|
+
|
|
3
|
+
[alembic]
|
|
4
|
+
# path to migration scripts
|
|
5
|
+
# Use forward slashes (/) also on windows to provide an os agnostic path
|
|
6
|
+
script_location = alembic
|
|
7
|
+
|
|
8
|
+
# template used to generate migration file names; The default value is %%(rev)s_%%(slug)s
|
|
9
|
+
# Uncomment the line below if you want the files to be prepended with date and time
|
|
10
|
+
# see https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file
|
|
11
|
+
# for all available tokens
|
|
12
|
+
# file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(rev)s_%%(slug)s
|
|
13
|
+
|
|
14
|
+
# sys.path path, will be prepended to sys.path if present.
|
|
15
|
+
# defaults to the current working directory.
|
|
16
|
+
prepend_sys_path = .
|
|
17
|
+
|
|
18
|
+
# timezone to use when rendering the date within the migration file
|
|
19
|
+
# as well as the filename.
|
|
20
|
+
# If specified, requires the python>=3.9 or backports.zoneinfo library.
|
|
21
|
+
# Any required deps can installed by adding `alembic[tz]` to the pip requirements
|
|
22
|
+
# string value is passed to ZoneInfo()
|
|
23
|
+
# leave blank for localtime
|
|
24
|
+
# timezone =
|
|
25
|
+
|
|
26
|
+
# max length of characters to apply to the "slug" field
|
|
27
|
+
# truncate_slug_length = 40
|
|
28
|
+
|
|
29
|
+
# set to 'true' to run the environment during
|
|
30
|
+
# the 'revision' command, regardless of autogenerate
|
|
31
|
+
# revision_environment = false
|
|
32
|
+
|
|
33
|
+
# set to 'true' to allow .pyc and .pyo files without
|
|
34
|
+
# a source .py file to be detected as revisions in the
|
|
35
|
+
# versions/ directory
|
|
36
|
+
# sourceless = false
|
|
37
|
+
|
|
38
|
+
# version location specification; This defaults
|
|
39
|
+
# to alembic/versions. When using multiple version
|
|
40
|
+
# directories, initial revisions must be specified with --version-path.
|
|
41
|
+
# The path separator used here should be the separator specified by "version_path_separator" below.
|
|
42
|
+
# version_locations = %(here)s/bar:%(here)s/bat:alembic/versions
|
|
43
|
+
|
|
44
|
+
# version path separator; As mentioned above, this is the character used to split
|
|
45
|
+
# version_locations. The default within new alembic.ini files is "os", which uses os.pathsep.
|
|
46
|
+
# If this key is omitted entirely, it falls back to the legacy behavior of splitting on spaces and/or commas.
|
|
47
|
+
# Valid values for version_path_separator are:
|
|
48
|
+
#
|
|
49
|
+
# version_path_separator = :
|
|
50
|
+
# version_path_separator = ;
|
|
51
|
+
# version_path_separator = space
|
|
52
|
+
# version_path_separator = newline
|
|
53
|
+
version_path_separator = os # Use os.pathsep. Default configuration used for new projects.
|
|
54
|
+
|
|
55
|
+
# set to 'true' to search source files recursively
|
|
56
|
+
# in each "version_locations" directory
|
|
57
|
+
# new in Alembic version 1.10
|
|
58
|
+
# recursive_version_locations = false
|
|
59
|
+
|
|
60
|
+
# the output encoding used when revision files
|
|
61
|
+
# are written from script.py.mako
|
|
62
|
+
# output_encoding = utf-8
|
|
63
|
+
|
|
64
|
+
sqlalchemy.url = postgresql+asyncpg://dmart:somepassword@localhost:5432/dmart
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
[post_write_hooks]
|
|
68
|
+
# post_write_hooks defines scripts or Python functions that are run
|
|
69
|
+
# on newly generated revision scripts. See the documentation for further
|
|
70
|
+
# detail and examples
|
|
71
|
+
|
|
72
|
+
# format using "black" - use the console_scripts runner, against the "black" entrypoint
|
|
73
|
+
# hooks = black
|
|
74
|
+
# black.type = console_scripts
|
|
75
|
+
# black.entrypoint = black
|
|
76
|
+
# black.options = -l 79 REVISION_SCRIPT_FILENAME
|
|
77
|
+
|
|
78
|
+
# lint with attempts to fix using "ruff" - use the exec runner, execute a binary
|
|
79
|
+
# hooks = ruff
|
|
80
|
+
# ruff.type = exec
|
|
81
|
+
# ruff.executable = %(here)s/.venv/bin/ruff
|
|
82
|
+
# ruff.options = --fix REVISION_SCRIPT_FILENAME
|
|
83
|
+
|
|
84
|
+
# Logging configuration
|
|
85
|
+
[loggers]
|
|
86
|
+
keys = root,sqlalchemy,alembic
|
|
87
|
+
|
|
88
|
+
[handlers]
|
|
89
|
+
keys = console
|
|
90
|
+
|
|
91
|
+
[formatters]
|
|
92
|
+
keys = generic
|
|
93
|
+
|
|
94
|
+
[logger_root]
|
|
95
|
+
level = WARNING
|
|
96
|
+
handlers = console
|
|
97
|
+
qualname =
|
|
98
|
+
|
|
99
|
+
[logger_sqlalchemy]
|
|
100
|
+
level = WARNING
|
|
101
|
+
handlers =
|
|
102
|
+
qualname = sqlalchemy.engine
|
|
103
|
+
|
|
104
|
+
[logger_alembic]
|
|
105
|
+
level = INFO
|
|
106
|
+
handlers =
|
|
107
|
+
qualname = alembic
|
|
108
|
+
|
|
109
|
+
[handler_console]
|
|
110
|
+
class = StreamHandler
|
|
111
|
+
args = (sys.stderr,)
|
|
112
|
+
level = NOTSET
|
|
113
|
+
formatter = generic
|
|
114
|
+
|
|
115
|
+
[formatter_generic]
|
|
116
|
+
format = %(levelname)-5.5s [%(name)s] %(message)s
|
|
117
|
+
datefmt = %H:%M:%S
|
dmart/config.env.sample
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
APP_URL="http://0.0.0.0:8282"
|
|
2
|
+
JWT_SECRET="ABC"
|
|
3
|
+
JWT_ALGORITHM="HS256"
|
|
4
|
+
LOG_FILE="../../logs/dmart.ljson.log"
|
|
5
|
+
WS_LOG_FILE="../../logs/websocket.ljson.log"
|
|
6
|
+
SPACES_FOLDER="../sample/spaces/"
|
|
7
|
+
BASE_PATH=""
|
|
8
|
+
MANAGEMENT_SPACE="management"
|
|
9
|
+
LISTENING_HOST="0.0.0.0"
|
|
10
|
+
LISTENING_PORT=8282
|
|
11
|
+
LOCK_PERIOD=180
|
|
12
|
+
mock_smtp_api=True
|
|
13
|
+
mock_smpp_api=True
|
|
14
|
+
IS_REGISTRABLE=True
|
|
15
|
+
smpp_auth_key=
|
|
16
|
+
REDIS_HOST="127.0.0.1"
|
|
17
|
+
REDIS_PASSWORD=""
|
|
18
|
+
REDIS_PORT=6379
|
|
19
|
+
mock_otp_code="123456"
|
|
20
|
+
ACTIVE_DATA_DB="file" # allowed values: file, sql
|
|
21
|
+
# DATABASE_DRIVER="postgresql+asyncpg"
|
|
22
|
+
DATABASE_DRIVER="postgresql+psycopg"
|
|
23
|
+
DATABASE_USERNAME="dmart"
|
|
24
|
+
DATABASE_PASSWORD="somepassword"
|
|
25
|
+
DATABASE_HOST="localhost"
|
|
26
|
+
DATABASE_PORT=5432
|
|
27
|
+
DATABASE_NAME="dmart"
|
dmart/conftest.py
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
from main import app
|
|
2
|
+
from httpx import AsyncClient, ASGITransport
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
@pytest.fixture(scope="session")
|
|
6
|
+
def anyio_backend():
|
|
7
|
+
return "asyncio"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.fixture(scope="session")
|
|
11
|
+
async def client():
|
|
12
|
+
async with AsyncClient(transport=ASGITransport(app=app, raise_app_exceptions=False), base_url="http://localhost",) as client:
|
|
13
|
+
yield client
|
dmart/curl.sh
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
API_URL="http://127.0.0.1:8282"
|
|
4
|
+
CT="Content-Type: application/json"
|
|
5
|
+
SHORTNAME="97326c47"
|
|
6
|
+
|
|
7
|
+
source ./login_creds.sh
|
|
8
|
+
declare -i RESULT=0
|
|
9
|
+
|
|
10
|
+
# echo -n -e "Create user: \t\t"
|
|
11
|
+
# CREATE=$(jq -c -n --arg shortname "$SHORTNAME" --arg msisdn "$MSISDN" --arg password "$PASSWORD" '{resource_type: "user", subpath: "users", shortname: $shortname, attributes:{password: $password, msisdn:$msisdn, invitation: "hello"}}')
|
|
12
|
+
# curl -s -H "$CT" -d "$CREATE" "${API_URL}/user/create?invitation=$INVITATION" | jq .status
|
|
13
|
+
|
|
14
|
+
# #echo -n -e "Send OTP using MSISDN: \t"
|
|
15
|
+
# #curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"msisdn": "'${MSISDN}'"}' ${API_URL}/user/otp-request | jq .
|
|
16
|
+
|
|
17
|
+
# #echo -n -e "Confirm OTP using MSISDN: \t"
|
|
18
|
+
# #curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"msisdn": "'${MSISDN}'", "code": "'${OTP_CODE}'"}' ${API_URL}/user/otp-confirm | jq .
|
|
19
|
+
|
|
20
|
+
echo -n -e "Login with admin: \t\t" >&2
|
|
21
|
+
AUTH_TOKEN=$(curl -i -s -H "$CT" -d "$SUPERMAN" ${API_URL}/user/login | grep set-cookie | sed 's/^[^=]*=\(.*\); Http.*$/\1/g')
|
|
22
|
+
RESULT+=$?
|
|
23
|
+
echo "$AUTH_TOKEN" | cut -d '.' -f 1 | base64 -d | jq .typ >&2
|
|
24
|
+
RESULT+=$?
|
|
25
|
+
# curl -s -c mycookies.jar -H "$CT" -d "$LOGIN" ${API_URL}/user/login | jq .status
|
|
26
|
+
|
|
27
|
+
echo -n -e "Get profile: \t\t\t" >&2
|
|
28
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" $API_URL/user/profile | jq .status | tee /dev/stderr | grep -q "success"
|
|
29
|
+
RESULT+=$?
|
|
30
|
+
|
|
31
|
+
echo -n -e "Create user from admin: \t" >&2
|
|
32
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"management","request_type":"create","records":[{"resource_type":"user","subpath":"users","shortname":"distributor","attributes":{"roles": ["test_role"], "msisdn": "7895412658", "email": "dummy_unqiue@gmail.com"}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
33
|
+
RESULT+=$?
|
|
34
|
+
|
|
35
|
+
echo -n -e "update user from admin: \t" >&2
|
|
36
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"management","request_type":"update","records":[{"resource_type":"user","subpath":"users","shortname":"distributor","attributes":{"roles": ["test_role"], "msisdn": "7895412658", "email": "dummy_unqiue@gmail.com"}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
37
|
+
RESULT+=$?
|
|
38
|
+
|
|
39
|
+
echo -n -e "Verify Email/msisdn admin side: " >&2
|
|
40
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"management","request_type":"update","records":[{"resource_type":"user","subpath":"users","shortname":"distributor","attributes":{"is_email_verified":true,"is_msisdn_verified":true}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
41
|
+
RESULT+=$?
|
|
42
|
+
|
|
43
|
+
echo -n -e "Reset user from admin side\t" >&2
|
|
44
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d $'{"shortname": "distributor"}' ${API_URL}/user/reset | jq .status | tee /dev/stderr | grep -q "success"
|
|
45
|
+
RESULT+=$?
|
|
46
|
+
|
|
47
|
+
echo -n -e "Delete user from admin: \t" >&2
|
|
48
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"management","request_type":"delete","records":[{"resource_type":"user","subpath":"users","shortname":"distributor","attributes":{}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
49
|
+
RESULT+=$?
|
|
50
|
+
|
|
51
|
+
#echo -n -e "Health check: \t\t\t"
|
|
52
|
+
#curl -s -H "Authorization: Bearer $AUTH_TOKEN" ${API_URL}/managed/health/management | jq .status | tee /dev/stderr | grep -q "success"
|
|
53
|
+
#RESULT+=$?
|
|
54
|
+
|
|
55
|
+
echo -n -e "Collection Contacts Query: \t" >&2
|
|
56
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"type": "search","space_name": "management","subpath": "users","retrieve_json_payload": true,"search": "","retrieve_attachments": true}' ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
|
|
57
|
+
RESULT+=$?
|
|
58
|
+
|
|
59
|
+
# echo -n -e "Saved Queries for Report"
|
|
60
|
+
# curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"attributes": {"limit": 10,"offcet": 0,"key_search": ""},"resource_type": "content","shortname": "info_service","subpath": "/reports"}' ${API_URL}/managed/excute/query/aftersales | jq
|
|
61
|
+
|
|
62
|
+
echo -n -e "JQ filter: \t\t\t" >&2
|
|
63
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"type": "search","space_name": "applications","subpath": "/","filter_types": ["folder"],"search": "applications","jq_filter" : ".[].shortname_title"}' ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
|
|
64
|
+
RESULT+=$?
|
|
65
|
+
|
|
66
|
+
echo -n -e "Reload security: \t\t" >&2
|
|
67
|
+
curl -s -b mycookies.jar -H "$CT" -H "Authorization: Bearer $AUTH_TOKEN" ${API_URL}/managed/reload-security-data | jq .status | tee /dev/stderr | grep -q "success"
|
|
68
|
+
RESULT+=$?
|
|
69
|
+
|
|
70
|
+
echo -n -e "Delete dummy space: \t\t" >&2
|
|
71
|
+
DELETE=$(jq -c -n '{ "space_name": "dummy", "request_type": "delete", "records": [{ "resource_type": "space", "subpath": "/", "shortname": "dummy","attributes": {} } ]}')
|
|
72
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$DELETE" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
73
|
+
# RESULT+=$?
|
|
74
|
+
|
|
75
|
+
echo -n -e "Create a new space (dummy): \t" >&2
|
|
76
|
+
CREATE=$(jq -c -n '{ "space_name": "dummy", "request_type": "create", "records": [{ "resource_type": "space", "subpath": "/", "shortname": "dummy","attributes": {"hide_space": true} } ]}')
|
|
77
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$CREATE" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
78
|
+
RESULT+=$?
|
|
79
|
+
|
|
80
|
+
echo -n -e "Query spaces: \t\t\t" >&2
|
|
81
|
+
RECORD=$(jq -c -n '{space_name: "dummy", type: "spaces", subpath: "/"}')
|
|
82
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$RECORD" ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
|
|
83
|
+
RESULT+=$?
|
|
84
|
+
|
|
85
|
+
echo -n -e "Create TLF folder: \t\t" >&2
|
|
86
|
+
REQUEST=$(jq -c -n '{ space_name: "dummy", request_type:"create", records: [{resource_type: "folder", subpath: "/", shortname: "myfolder", attributes:{tags: ["one","two"], "description": {"en": "dummy","ar": "dummy","ku": "dummy"},"displayname" : {"en": "en","ar": "ar", "ku":"ku"}, "payload": { "content_type": "json", "schema_shortname": "folder_rendering", "body": { "shortname_title": "Schema Shortname", "content_schema_shortnames": ["meta_schema"], "index_attributes": [ { "key": "shortname", "name": "Schema Shortname" }], "allow_create": false, "allow_update": false, "allow_delete": false, "use_media": false }}}}]}')
|
|
87
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
88
|
+
RESULT+=$?
|
|
89
|
+
SUBPATH="posts"
|
|
90
|
+
|
|
91
|
+
echo -n -e "Create posts folder: \t\t" >&2
|
|
92
|
+
REQUEST=$(jq -c -n --arg subpath "/" --arg shortname "posts" '{ space_name: "dummy", request_type:"create", records: [{resource_type: "folder", subpath: "/", shortname: "posts", attributes:{tags: ["one","two"], is_active: true, "description": {"en": "dummy","ar": "dummy","ku": "dummy"},"displayname" : {"en": "en","ar": "ar", "ku":"ku"}, "payload": { "content_type": "json", "schema_shortname": "folder_rendering", "body": { "shortname_title": "Shortname", "content_schema_shortnames": ["content"], "index_attributes": [ { "key": "shortname", "name": "Shortname" }], "allow_create": false, "allow_update": false, "allow_delete": false, "use_media": false }}}}]}')
|
|
93
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
94
|
+
RESULT+=$?
|
|
95
|
+
|
|
96
|
+
echo -n -e "Create workflow folder: \t" >&2
|
|
97
|
+
REQUEST=$(jq -c -n '{ space_name: "dummy", request_type:"create", records: [{resource_type: "folder", subpath: "/", shortname: "workflows", attributes:{ "description": {"en": "dummy","ar": "dummy","ku": "dummy"},"displayname" : {"en": "en","ar": "ar", "ku":"ku"}, "payload": { "content_type": "json", "schema_shortname": "folder_rendering", "body": { "shortname_title": "Schema Shortname", "content_schema_shortnames": ["meta_schema"], "index_attributes": [ { "key": "shortname", "name": "Schema Shortname" }], "allow_create": false, "allow_update": false, "allow_delete": false, "use_media": false }}}}]}')
|
|
98
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
99
|
+
RESULT+=$?
|
|
100
|
+
SUBPATH="posts"
|
|
101
|
+
|
|
102
|
+
echo -n -e "Query folders: \t\t\t" >&2
|
|
103
|
+
REQUEST=$(jq -c -n '{ space_name: "dummy", type:"subpath", subpath: "/", }')
|
|
104
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
|
|
105
|
+
RESULT+=$?
|
|
106
|
+
|
|
107
|
+
echo -n -e "Create Schema for workflows: \t" >&2
|
|
108
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' 'request_type: "create"' -F 'request_record=@"../sample/test/createschemawork.json"' -F 'payload_file=@"../sample/test/workflow_schema.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
|
|
109
|
+
RESULT+=$?
|
|
110
|
+
|
|
111
|
+
echo -n -e "Create content for workflows: \t" >&2
|
|
112
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' -F 'request_record=@"../sample/test/createticket.json"' -F 'payload_file=@"../sample/test/ticket_workflow.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
|
|
113
|
+
RESULT+=$?
|
|
114
|
+
|
|
115
|
+
echo -n -e "Create Schema for ticket: \t" >&2
|
|
116
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' -F 'request_record=@"../sample/test/createschema.json"' -F 'payload_file=@"../sample/test/schema.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
|
|
117
|
+
RESULT+=$?
|
|
118
|
+
|
|
119
|
+
# echo -n -e "Create QR Code: \t\t" >&2
|
|
120
|
+
# TEMP_FILE=$(mktemp)
|
|
121
|
+
# curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" --output $TEMP_FILE ${API_URL}/qr/generate/ticket/dummy/myfolder/an_example # | jq .status | tee /dev/stderr | grep -q "success"
|
|
122
|
+
# RESULT+=$?
|
|
123
|
+
# file -ib $TEMP_FILE >&2
|
|
124
|
+
# rm -f $TEMP_FILE
|
|
125
|
+
#curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F ${API_URL}/qr/generate/ticket/dummy/myfolder/an_example | jq .status | tee /dev/stderr | grep -q "success"
|
|
126
|
+
|
|
127
|
+
echo -n -e "Create ticket: \t\t\t" >&2
|
|
128
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' 'request_type: "create"' -F 'request_record=@"../sample/test/ticketcontent.json"' -F 'payload_file=@"../sample/test/ticketbody.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
|
|
129
|
+
RESULT+=$?
|
|
130
|
+
|
|
131
|
+
echo -n -e "Move ticket: \t\t\t" >&2
|
|
132
|
+
curl -s -H "$CT" -H "Authorization: Bearer $AUTH_TOKEN" -d '{"space_name": "dummy","request_type": "move","records": [{"resource_type": "ticket","subpath": "/myfolder","shortname": "an_example","attributes": {"src_subpath": "/myfolder","src_shortname": "an_example","dest_subpath": "/myfolder_new","dest_shortname": "an_example_new", "src_space_name": "dummy", "dest_space_name": "dummy", "is_active": true}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
133
|
+
|
|
134
|
+
echo -n -e "Move back to old: \t\t" >&2
|
|
135
|
+
curl -s -H "$CT" -H "Authorization: Bearer $AUTH_TOKEN" -d '{"space_name": "dummy","request_type": "move","records": [{"resource_type": "ticket","subpath": "/myfolder_new","shortname": "an_example_new","attributes": {"src_subpath": "/myfolder_new","src_shortname": "an_example_new","dest_subpath": "/myfolder","dest_shortname": "an_example", "src_space_name": "dummy", "dest_space_name": "dummy","is_active": true}}]}' ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
136
|
+
|
|
137
|
+
echo -n -e "Lock ticket: \t\t\t" >&2
|
|
138
|
+
curl -s -X "PUT" -H "Authorization: Bearer $AUTH_TOKEN" ${API_URL}/managed/lock/ticket/dummy/myfolder/an_example | jq .status | tee /dev/stderr | grep -q "success"
|
|
139
|
+
|
|
140
|
+
echo -n -e "Unlock ticket: \t\t\t" >&2
|
|
141
|
+
curl -s -X "DELETE" -H "Authorization: Bearer $AUTH_TOKEN" ${API_URL}/managed/lock/dummy/myfolder/an_example | jq .status | tee /dev/stderr | grep -q "success"
|
|
142
|
+
|
|
143
|
+
echo -n -e "Create Content: \t\t" >&2
|
|
144
|
+
REQUEST=$(jq -c -n --arg subpath "$SUBPATH" --arg shortname "$SHORTNAME" '{ space_name: "dummy", request_type:"create", records: [{resource_type: "content", subpath: $subpath, shortname: $shortname, attributes:{payload: {body: {"message": "this content created from curl request for dummying"}, content_type: "json"}, tags: ["one","two"], "description": {"en": "dummy","ar": "dummy","ku": "dummy"},"displayname" : {"en": "en","ar": "ar", "ku":"ku"}}}]}')
|
|
145
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$REQUEST" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
146
|
+
RESULT+=$?
|
|
147
|
+
|
|
148
|
+
echo -n -e "Create content: \t\t" >&2
|
|
149
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' -F 'request_record=@"../sample/test/createcontent.json"' -F 'payload_file=@"../sample/test/data.json"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
|
|
150
|
+
RESULT+=$?
|
|
151
|
+
|
|
152
|
+
echo -n -e "Comment on content: \t\t"
|
|
153
|
+
COMMENT_SHORTNAME="greatcomment"
|
|
154
|
+
COMMENT_SUBPATH="$SUBPATH/$SHORTNAME"
|
|
155
|
+
RECORD=$(jq -c -n --arg subpath "$COMMENT_SUBPATH" --arg shortname "$COMMENT_SHORTNAME" '{ space_name: "dummy", request_type:"create", records: [{resource_type: "comment", subpath: $subpath, shortname: $shortname, attributes:{body: "A comment insdie the content resource"}}]}')
|
|
156
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$RECORD" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
157
|
+
|
|
158
|
+
echo -n -e "Managed CSV: \t\t\t" >&2
|
|
159
|
+
curl -s -H "accept: text/csv" -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{"space_name":"dummy","subpath":"myfolder","type":"subpath","retrieve_json_payload":true,"limit":5}' ${API_URL}/managed/csv | wc -l | xargs -IN test N -ge 2 > /dev/null && echo '"success"' #| xargs -0 echo | jq .status | tee /dev/stderr | grep -q "success"
|
|
160
|
+
RESULT+=$?
|
|
161
|
+
|
|
162
|
+
echo -n -e "Update content: \t\t" >&2
|
|
163
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" --data-binary "@../sample/test/updatecontent.json" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
164
|
+
RESULT+=$?
|
|
165
|
+
|
|
166
|
+
echo -n -e "Upload attachment: \t\t" >&2
|
|
167
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -F 'space_name="dummy"' -F 'request_record=@"../sample/test/createmedia.json"' -F 'payload_file=@"../sample/test/logo.jpeg"' ${API_URL}/managed/resource_with_payload | jq .status | tee /dev/stderr | grep -q "success"
|
|
168
|
+
RESULT+=$?
|
|
169
|
+
|
|
170
|
+
echo -n -e "Delete content: \t\t" >&2
|
|
171
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" --data-binary "@../sample/test/deletecontent.json" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
172
|
+
RESULT+=$?
|
|
173
|
+
|
|
174
|
+
echo -n -e "Query content: \t\t\t" >&2
|
|
175
|
+
RECORD=$(jq -c -n --arg subpath "$SUBPATH" '{space_name: "dummy", type: "subpath", subpath: $subpath}')
|
|
176
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$RECORD" ${API_URL}/managed/query | jq .status | tee /dev/stderr | grep -q "success"
|
|
177
|
+
RESULT+=$?
|
|
178
|
+
|
|
179
|
+
#echo -n -e "reload redis data: \t\t"
|
|
180
|
+
#RECORD=$(jq -c -n --arg subpath "$SUBPATH" '{space_name: "dummy", for_schemas: ["dummy_schema"]}')
|
|
181
|
+
#curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$RECORD" ${API_URL}/managed/reload-redis-data | jq .status | tee /dev/stderr | grep -q "success"
|
|
182
|
+
|
|
183
|
+
#echo -n -e "Delete admin: \t\t"
|
|
184
|
+
#curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d '{}' $API_URL/user/delete | jq .status | tee /dev/stderr | grep -q "success"
|
|
185
|
+
|
|
186
|
+
echo -n -e "Delete dummy space: \t\t" >&2
|
|
187
|
+
DELETE=$(jq -c -n '{ "space_name": "dummy", "request_type": "delete", "records": [{ "resource_type": "space", "subpath": "/", "shortname": "dummy","attributes": {} } ]}')
|
|
188
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" -d "$DELETE" ${API_URL}/managed/request | jq .status | tee /dev/stderr | grep -q "success"
|
|
189
|
+
RESULT+=$?
|
|
190
|
+
|
|
191
|
+
echo -n -e "Server manifest: " >&2
|
|
192
|
+
curl -s -H "Authorization: Bearer $AUTH_TOKEN" -H "$CT" ${API_URL}/info/manifest | jq . >&2
|
|
193
|
+
RESULT+=$?
|
|
194
|
+
|
|
195
|
+
echo "Sum of exit codes = $RESULT" >&2
|
|
196
|
+
exit $RESULT
|