From 30a8e73f21f5d0ba184cad678d910f775203fbed Mon Sep 17 00:00:00 2001 From: Marko <52066939+HeX87@users.noreply.github.com> Date: Wed, 14 Jun 2023 17:02:24 +0200 Subject: [PATCH] Slack notify --- .env | 11 +- .env.sample | 38 - .gitignore | 10 + .idea/CdsConnector.iml | 21 +- .idea/dataSources.xml | 4 +- .idea/php.xml | 26 +- README.md | 3 + composer.json | 10 +- composer.lock | 1626 ++++++++--------- config/bundles.php | 2 +- config/packages/api_platform.yaml | 39 - config/packages/framework.yaml | 3 - config/packages/notifier.yaml | 16 + config/services.yaml | 9 - docker-compose.override.yml | 6 +- docker-compose.yml | 19 + .../apiplatform/fonts/open-sans/400.css | 63 +- .../apiplatform/fonts/open-sans/700.css | 63 +- .../bundles/apiplatform/graphiql/graphiql.css | 44 +- .../apiplatform/graphiql/graphiql.min.js | 31 +- public/bundles/apiplatform/init-graphiql.js | 5 +- public/bundles/apiplatform/style.css | 4 + src/Command/JtlExportCommand.php | 82 + src/Command/JtlImportCommand.php | 60 + src/Command/SwGetOrdersCommand.php | 14 +- src/Entity/Product.php | 10 +- src/EventSubscriber/SlackNotifySubscriber.php | 52 + src/Helper/Jtl.php | 85 + src/Helper/Slack.php | 32 + symfony.lock | 44 +- templates/slack/index.html.twig | 20 + .../SlackNotifySubscriberTest.php | 15 + tests/bootstrap.php | 4 - 33 files changed, 1334 insertions(+), 1137 deletions(-) delete mode 100644 .env.sample delete mode 100644 config/packages/api_platform.yaml create mode 100644 config/packages/notifier.yaml create mode 100644 src/Command/JtlExportCommand.php create mode 100644 src/Command/JtlImportCommand.php create mode 100644 src/EventSubscriber/SlackNotifySubscriber.php create mode 100644 src/Helper/Jtl.php create mode 100644 src/Helper/Slack.php create mode 100644 templates/slack/index.html.twig create mode 100644 tests/EventSubscriber/SlackNotifySubscriberTest.php diff --git a/.env b/.env index 51bfd65..bd03d95 100644 --- a/.env +++ b/.env @@ -24,16 +24,17 @@ APP_SECRET=e5a2fe31ff8ce325266d52632a0ba5df # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml # # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" -DATABASE_URL="mysql://db:db@db:3306/db?serverVersion=mariadb-10.4.11&charset=utf8mb4" -#DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8" +# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4" +DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8" ###< doctrine/doctrine-bundle ### ###> nelmio/cors-bundle ### CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$' ###< nelmio/cors-bundle ### -SHOPWARE_API_URL="ddev-flex-web" +SHOPWARE_API_URL="http://flex.ddev.site/" SHOPWARE_API_ID="SWIAB21GBEHEU0DLVKNIRE5CDG" SHOPWARE_API_KEY="NWIwbjRFNWNXU1d0WUtMTUpzRU05OFVIZ1N4MFdwYUdHVjhTdWk" - - +###> symfony/slack-notifier ### +# SLACK_DSN=slack://TOKEN@default?channel=CHANNEL +###< symfony/slack-notifier ### diff --git a/.env.sample b/.env.sample deleted file mode 100644 index b3c454f..0000000 --- a/.env.sample +++ /dev/null @@ -1,38 +0,0 @@ -# In all environments, the following files are loaded if they exist, -# the latter taking precedence over the former: -# -# * .env contains default values for the environment variables needed by the app -# * .env.local uncommitted file with local overrides -# * .env.$APP_ENV committed environment-specific defaults -# * .env.$APP_ENV.local uncommitted environment-specific overrides -# -# Real environment variables win over .env files. -# -# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES. -# https://symfony.com/doc/current/configuration/secrets.html -# -# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2). -# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration - -###> symfony/framework-bundle ### -APP_ENV=dev -APP_SECRET=e5a2fe31ff8ce325266d52632a0ba5df -###< symfony/framework-bundle ### - -###> doctrine/doctrine-bundle ### -# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url -# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml -# -# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" -DATABASE_URL="mysql://root:root@mysql:3306/cds_connector?serverVersion=5.7&charset=utf8mb4" -#DATABASE_URL="postgresql://symfony:ChangeMe@127.0.0.1:5432/app?serverVersion=13&charset=utf8" -###< doctrine/doctrine-bundle ### - -###> nelmio/cors-bundle ### -CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$' -###< nelmio/cors-bundle ### - -SHOPWARE_API_URL="development.dev.localhost" -SHOPWARE_API_KEY="S2hySDNyZ214dGRVQmFBSURQbkRvajIyZldxOHB4RktZakxaYmo" -SHOPWARE_API_ID="SWUAB1JGAFHTMME5DUGWDWN1EQ" - diff --git a/.gitignore b/.gitignore index d1839db..6505e54 100644 --- a/.gitignore +++ b/.gitignore @@ -64,3 +64,13 @@ /phpunit.xml .phpunit.result.cache ###< phpunit/phpunit ### + +###> symfony/framework-bundle ### +/.env.local +/.env.local.php +/.env.*.local +/config/secrets/prod/prod.decrypt.private.php +/public/bundles/ +/var/ +/vendor/ +###< symfony/framework-bundle ### diff --git a/.idea/CdsConnector.iml b/.idea/CdsConnector.iml index 57d80e4..5e219a8 100644 --- a/.idea/CdsConnector.iml +++ b/.idea/CdsConnector.iml @@ -22,32 +22,22 @@ - - - - - - - - - - @@ -67,7 +57,6 @@ - @@ -110,7 +99,6 @@ - @@ -132,6 +120,15 @@ + + + + + + + + + diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml index ef5c13b..6a23776 100644 --- a/.idea/dataSources.xml +++ b/.idea/dataSources.xml @@ -8,13 +8,13 @@ jdbc:mysql://127.0.0.1:3306 $ProjectFileDir$ - + mariadb true true DDEV generated data source org.mariadb.jdbc.Driver - jdbc:mariadb://127.0.0.1:32836/db?user=db&password=db + jdbc:mariadb://127.0.0.1:51951/db?user=db&password=db $ProjectFileDir$ diff --git a/.idea/php.xml b/.idea/php.xml index ce928cd..383f53c 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -28,32 +28,22 @@ - - - - - - - - - - @@ -73,7 +63,6 @@ - @@ -116,7 +105,6 @@ - @@ -138,12 +126,22 @@ + + + + + + + + + + - - + +