3 Commits

Author SHA1 Message Date
e02fa4fc67 Display prices in PLN
All checks were successful
/ deploy-job (push) Successful in 1s
2026-02-27 11:37:23 +01:00
5088f6173f Add conversion rate to products, prices, and save them while scraping.
All checks were successful
/ deploy-job (push) Successful in 1s
2026-02-26 09:15:02 +01:00
09825de7b9 Add a source of currency exchange rates to scrape command.
All checks were successful
/ deploy-job (push) Successful in 1s
2026-02-25 09:10:14 +01:00
11 changed files with 174 additions and 198 deletions

View File

@@ -1,7 +1,5 @@
on:
push:
branches:
- master
workflow_dispatch:
jobs:
deploy-job:

200
composer.lock generated
View File

@@ -1616,16 +1616,16 @@
},
{
"name": "symfony/cache",
"version": "v8.0.6",
"version": "v8.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/cache.git",
"reference": "59184fa14658d7724cd9b8743d91c1b1aa618bff"
"reference": "92e9960386c7e01f58198038c199d522959a843c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/cache/zipball/59184fa14658d7724cd9b8743d91c1b1aa618bff",
"reference": "59184fa14658d7724cd9b8743d91c1b1aa618bff",
"url": "https://api.github.com/repos/symfony/cache/zipball/92e9960386c7e01f58198038c199d522959a843c",
"reference": "92e9960386c7e01f58198038c199d522959a843c",
"shasum": ""
},
"require": {
@@ -1692,7 +1692,7 @@
"psr6"
],
"support": {
"source": "https://github.com/symfony/cache/tree/v8.0.6"
"source": "https://github.com/symfony/cache/tree/v8.0.5"
},
"funding": [
{
@@ -1712,7 +1712,7 @@
"type": "tidelift"
}
],
"time": "2026-02-21T23:29:37+00:00"
"time": "2026-01-27T16:18:07+00:00"
},
{
"name": "symfony/cache-contracts",
@@ -1869,16 +1869,16 @@
},
{
"name": "symfony/config",
"version": "v8.0.6",
"version": "v8.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
"reference": "94ea198de42f93dffa920a098cac3961a82e63b7"
"reference": "8f45af92f08f82902827a8b6f403aaf49d893539"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/94ea198de42f93dffa920a098cac3961a82e63b7",
"reference": "94ea198de42f93dffa920a098cac3961a82e63b7",
"url": "https://api.github.com/repos/symfony/config/zipball/8f45af92f08f82902827a8b6f403aaf49d893539",
"reference": "8f45af92f08f82902827a8b6f403aaf49d893539",
"shasum": ""
},
"require": {
@@ -1923,7 +1923,7 @@
"description": "Helps you find, load, combine, autofill and validate configuration values of any kind",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/config/tree/v8.0.6"
"source": "https://github.com/symfony/config/tree/v8.0.4"
},
"funding": [
{
@@ -1943,20 +1943,20 @@
"type": "tidelift"
}
],
"time": "2026-02-25T16:59:43+00:00"
"time": "2026-01-13T13:06:50+00:00"
},
{
"name": "symfony/console",
"version": "v8.0.6",
"version": "v8.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "488285876e807a4777f074041d8bb508623419fa"
"reference": "ace03c4cf9805080ff40cbeec69fca180c339a3b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/488285876e807a4777f074041d8bb508623419fa",
"reference": "488285876e807a4777f074041d8bb508623419fa",
"url": "https://api.github.com/repos/symfony/console/zipball/ace03c4cf9805080ff40cbeec69fca180c339a3b",
"reference": "ace03c4cf9805080ff40cbeec69fca180c339a3b",
"shasum": ""
},
"require": {
@@ -2013,7 +2013,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v8.0.6"
"source": "https://github.com/symfony/console/tree/v8.0.4"
},
"funding": [
{
@@ -2033,20 +2033,20 @@
"type": "tidelift"
}
],
"time": "2026-02-25T16:59:43+00:00"
"time": "2026-01-13T13:06:50+00:00"
},
{
"name": "symfony/dependency-injection",
"version": "v8.0.6",
"version": "v8.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/dependency-injection.git",
"reference": "edd98864a7b9eaaa10f389bd414e7d9e816bb59d"
"reference": "40a6c455ade7e3bf25900d6b746d40cfa2573e26"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/edd98864a7b9eaaa10f389bd414e7d9e816bb59d",
"reference": "edd98864a7b9eaaa10f389bd414e7d9e816bb59d",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/40a6c455ade7e3bf25900d6b746d40cfa2573e26",
"reference": "40a6c455ade7e3bf25900d6b746d40cfa2573e26",
"shasum": ""
},
"require": {
@@ -2094,7 +2094,7 @@
"description": "Allows you to standardize and centralize the way objects are constructed in your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/dependency-injection/tree/v8.0.6"
"source": "https://github.com/symfony/dependency-injection/tree/v8.0.5"
},
"funding": [
{
@@ -2114,7 +2114,7 @@
"type": "tidelift"
}
],
"time": "2026-02-25T16:59:43+00:00"
"time": "2026-01-27T16:18:07+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -2185,16 +2185,16 @@
},
{
"name": "symfony/dotenv",
"version": "v8.0.6",
"version": "v8.0.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/dotenv.git",
"reference": "94d59769b0ea491dd8b635089e766519d28773d6"
"reference": "460b4067a85288c59a59ce8c1bfb3942e71fd85c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/dotenv/zipball/94d59769b0ea491dd8b635089e766519d28773d6",
"reference": "94d59769b0ea491dd8b635089e766519d28773d6",
"url": "https://api.github.com/repos/symfony/dotenv/zipball/460b4067a85288c59a59ce8c1bfb3942e71fd85c",
"reference": "460b4067a85288c59a59ce8c1bfb3942e71fd85c",
"shasum": ""
},
"require": {
@@ -2235,7 +2235,7 @@
"environment"
],
"support": {
"source": "https://github.com/symfony/dotenv/tree/v8.0.6"
"source": "https://github.com/symfony/dotenv/tree/v8.0.0"
},
"funding": [
{
@@ -2255,7 +2255,7 @@
"type": "tidelift"
}
],
"time": "2026-02-13T12:00:38+00:00"
"time": "2025-11-16T10:17:21+00:00"
},
{
"name": "symfony/error-handler",
@@ -2501,16 +2501,16 @@
},
{
"name": "symfony/filesystem",
"version": "v8.0.6",
"version": "v8.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "7bf9162d7a0dff98d079b72948508fa48018a770"
"reference": "d937d400b980523dc9ee946bb69972b5e619058d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/7bf9162d7a0dff98d079b72948508fa48018a770",
"reference": "7bf9162d7a0dff98d079b72948508fa48018a770",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/d937d400b980523dc9ee946bb69972b5e619058d",
"reference": "d937d400b980523dc9ee946bb69972b5e619058d",
"shasum": ""
},
"require": {
@@ -2547,7 +2547,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v8.0.6"
"source": "https://github.com/symfony/filesystem/tree/v8.0.1"
},
"funding": [
{
@@ -2567,20 +2567,20 @@
"type": "tidelift"
}
],
"time": "2026-02-25T16:59:43+00:00"
"time": "2025-12-01T09:13:36+00:00"
},
{
"name": "symfony/finder",
"version": "v8.0.6",
"version": "v8.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "441404f09a54de6d1bd6ad219e088cdf4c91f97c"
"reference": "8bd576e97c67d45941365bf824e18dc8538e6eb0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/441404f09a54de6d1bd6ad219e088cdf4c91f97c",
"reference": "441404f09a54de6d1bd6ad219e088cdf4c91f97c",
"url": "https://api.github.com/repos/symfony/finder/zipball/8bd576e97c67d45941365bf824e18dc8538e6eb0",
"reference": "8bd576e97c67d45941365bf824e18dc8538e6eb0",
"shasum": ""
},
"require": {
@@ -2615,7 +2615,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v8.0.6"
"source": "https://github.com/symfony/finder/tree/v8.0.5"
},
"funding": [
{
@@ -2635,20 +2635,20 @@
"type": "tidelift"
}
],
"time": "2026-01-29T09:41:02+00:00"
"time": "2026-01-26T15:08:38+00:00"
},
{
"name": "symfony/framework-bundle",
"version": "v8.0.6",
"version": "v8.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/framework-bundle.git",
"reference": "86ebd86908edca06e3af5994bc46881575fbe813"
"reference": "e2f9469e7a802dd7c0d193792afc494d68177c54"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/framework-bundle/zipball/86ebd86908edca06e3af5994bc46881575fbe813",
"reference": "86ebd86908edca06e3af5994bc46881575fbe813",
"url": "https://api.github.com/repos/symfony/framework-bundle/zipball/e2f9469e7a802dd7c0d193792afc494d68177c54",
"reference": "e2f9469e7a802dd7c0d193792afc494d68177c54",
"shasum": ""
},
"require": {
@@ -2671,7 +2671,7 @@
},
"conflict": {
"doctrine/persistence": "<1.3",
"phpdocumentor/reflection-docblock": "<5.2|>=7",
"phpdocumentor/reflection-docblock": "<5.2|>=6",
"phpdocumentor/type-resolver": "<1.5.1",
"symfony/console": "<7.4",
"symfony/form": "<7.4",
@@ -2686,7 +2686,7 @@
"require-dev": {
"doctrine/persistence": "^1.3|^2|^3",
"dragonmantank/cron-expression": "^3.1",
"phpdocumentor/reflection-docblock": "^5.2|^6.0",
"phpdocumentor/reflection-docblock": "^5.2",
"phpstan/phpdoc-parser": "^1.0|^2.0",
"seld/jsonlint": "^1.10",
"symfony/asset": "^7.4|^8.0",
@@ -2755,7 +2755,7 @@
"description": "Provides a tight integration between Symfony components and the Symfony full-stack framework",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/framework-bundle/tree/v8.0.6"
"source": "https://github.com/symfony/framework-bundle/tree/v8.0.5"
},
"funding": [
{
@@ -2775,20 +2775,20 @@
"type": "tidelift"
}
],
"time": "2026-02-25T16:59:43+00:00"
"time": "2026-01-27T09:06:10+00:00"
},
{
"name": "symfony/http-foundation",
"version": "v8.0.6",
"version": "v8.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
"reference": "7745ff1aad45d855fe25b08969269ef83b1ad8bc"
"reference": "e3422806e6f6760dbed0ddbc0a7fbfb6b5ce96bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/7745ff1aad45d855fe25b08969269ef83b1ad8bc",
"reference": "7745ff1aad45d855fe25b08969269ef83b1ad8bc",
"url": "https://api.github.com/repos/symfony/http-foundation/zipball/e3422806e6f6760dbed0ddbc0a7fbfb6b5ce96bb",
"reference": "e3422806e6f6760dbed0ddbc0a7fbfb6b5ce96bb",
"shasum": ""
},
"require": {
@@ -2835,7 +2835,7 @@
"description": "Defines an object-oriented layer for the HTTP specification",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-foundation/tree/v8.0.6"
"source": "https://github.com/symfony/http-foundation/tree/v8.0.5"
},
"funding": [
{
@@ -2855,20 +2855,20 @@
"type": "tidelift"
}
],
"time": "2026-02-21T16:28:39+00:00"
"time": "2026-01-27T16:18:07+00:00"
},
{
"name": "symfony/http-kernel",
"version": "v8.0.6",
"version": "v8.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-kernel.git",
"reference": "b567e571e74b5774b3d3cb4d35bdafa5f37e51a9"
"reference": "20c1c5e41fc53928dbb670088f544f2d460d497d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/b567e571e74b5774b3d3cb4d35bdafa5f37e51a9",
"reference": "b567e571e74b5774b3d3cb4d35bdafa5f37e51a9",
"url": "https://api.github.com/repos/symfony/http-kernel/zipball/20c1c5e41fc53928dbb670088f544f2d460d497d",
"reference": "20c1c5e41fc53928dbb670088f544f2d460d497d",
"shasum": ""
},
"require": {
@@ -2939,7 +2939,7 @@
"description": "Provides a structured process for converting a Request into a Response",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/http-kernel/tree/v8.0.6"
"source": "https://github.com/symfony/http-kernel/tree/v8.0.5"
},
"funding": [
{
@@ -2959,20 +2959,20 @@
"type": "tidelift"
}
],
"time": "2026-02-26T08:36:42+00:00"
"time": "2026-01-28T10:46:31+00:00"
},
{
"name": "symfony/intl",
"version": "v8.0.6",
"version": "v8.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/intl.git",
"reference": "4e14323828f51a293edbce15ca98d4f3dd927cbf"
"reference": "8d049269c2accca0b02e5f9de39f3ee92ebc4468"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/intl/zipball/4e14323828f51a293edbce15ca98d4f3dd927cbf",
"reference": "4e14323828f51a293edbce15ca98d4f3dd927cbf",
"url": "https://api.github.com/repos/symfony/intl/zipball/8d049269c2accca0b02e5f9de39f3ee92ebc4468",
"reference": "8d049269c2accca0b02e5f9de39f3ee92ebc4468",
"shasum": ""
},
"require": {
@@ -3028,7 +3028,7 @@
"localization"
],
"support": {
"source": "https://github.com/symfony/intl/tree/v8.0.6"
"source": "https://github.com/symfony/intl/tree/v8.0.4"
},
"funding": [
{
@@ -3048,7 +3048,7 @@
"type": "tidelift"
}
],
"time": "2026-02-09T10:14:57+00:00"
"time": "2026-01-12T12:37:40+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -3467,16 +3467,16 @@
},
{
"name": "symfony/routing",
"version": "v8.0.6",
"version": "v8.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/routing.git",
"reference": "053c40fd46e1d19c5c5a94cada93ce6c3facdd55"
"reference": "4a2bc08d1c35307239329f434d45c2bfe8241fa9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/routing/zipball/053c40fd46e1d19c5c5a94cada93ce6c3facdd55",
"reference": "053c40fd46e1d19c5c5a94cada93ce6c3facdd55",
"url": "https://api.github.com/repos/symfony/routing/zipball/4a2bc08d1c35307239329f434d45c2bfe8241fa9",
"reference": "4a2bc08d1c35307239329f434d45c2bfe8241fa9",
"shasum": ""
},
"require": {
@@ -3523,7 +3523,7 @@
"url"
],
"support": {
"source": "https://github.com/symfony/routing/tree/v8.0.6"
"source": "https://github.com/symfony/routing/tree/v8.0.4"
},
"funding": [
{
@@ -3543,7 +3543,7 @@
"type": "tidelift"
}
],
"time": "2026-02-25T16:59:43+00:00"
"time": "2026-01-12T12:37:40+00:00"
},
{
"name": "symfony/service-contracts",
@@ -3634,16 +3634,16 @@
},
{
"name": "symfony/string",
"version": "v8.0.6",
"version": "v8.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "6c9e1108041b5dce21a9a4984b531c4923aa9ec4"
"reference": "758b372d6882506821ed666032e43020c4f57194"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/6c9e1108041b5dce21a9a4984b531c4923aa9ec4",
"reference": "6c9e1108041b5dce21a9a4984b531c4923aa9ec4",
"url": "https://api.github.com/repos/symfony/string/zipball/758b372d6882506821ed666032e43020c4f57194",
"reference": "758b372d6882506821ed666032e43020c4f57194",
"shasum": ""
},
"require": {
@@ -3700,7 +3700,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v8.0.6"
"source": "https://github.com/symfony/string/tree/v8.0.4"
},
"funding": [
{
@@ -3720,20 +3720,20 @@
"type": "tidelift"
}
],
"time": "2026-02-09T10:14:57+00:00"
"time": "2026-01-12T12:37:40+00:00"
},
{
"name": "symfony/translation",
"version": "v8.0.6",
"version": "v8.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/translation.git",
"reference": "13ff19bcf2bea492d3c2fbeaa194dd6f4599ce1b"
"reference": "db70c8ce7db74fd2da7b1d268db46b2a8ce32c10"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/13ff19bcf2bea492d3c2fbeaa194dd6f4599ce1b",
"reference": "13ff19bcf2bea492d3c2fbeaa194dd6f4599ce1b",
"url": "https://api.github.com/repos/symfony/translation/zipball/db70c8ce7db74fd2da7b1d268db46b2a8ce32c10",
"reference": "db70c8ce7db74fd2da7b1d268db46b2a8ce32c10",
"shasum": ""
},
"require": {
@@ -3793,7 +3793,7 @@
"description": "Provides tools to internationalize your application",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/translation/tree/v8.0.6"
"source": "https://github.com/symfony/translation/tree/v8.0.4"
},
"funding": [
{
@@ -3813,7 +3813,7 @@
"type": "tidelift"
}
],
"time": "2026-02-17T13:07:04+00:00"
"time": "2026-01-13T13:06:50+00:00"
},
{
"name": "symfony/translation-contracts",
@@ -3899,16 +3899,16 @@
},
{
"name": "symfony/twig-bridge",
"version": "v8.0.6",
"version": "v8.0.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/twig-bridge.git",
"reference": "a29b174218f6eb324bf24f60440ac81d17f6ee0d"
"reference": "3e60c35cb47b1077524c066ec277eaf92cdc2393"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/twig-bridge/zipball/a29b174218f6eb324bf24f60440ac81d17f6ee0d",
"reference": "a29b174218f6eb324bf24f60440ac81d17f6ee0d",
"url": "https://api.github.com/repos/symfony/twig-bridge/zipball/3e60c35cb47b1077524c066ec277eaf92cdc2393",
"reference": "3e60c35cb47b1077524c066ec277eaf92cdc2393",
"shasum": ""
},
"require": {
@@ -3917,14 +3917,14 @@
"twig/twig": "^3.21"
},
"conflict": {
"phpdocumentor/reflection-docblock": "<5.2|>=7",
"phpdocumentor/reflection-docblock": "<5.2|>=6",
"phpdocumentor/type-resolver": "<1.5.1",
"symfony/form": "<7.4.4|>8.0,<8.0.4"
},
"require-dev": {
"egulias/email-validator": "^2.1.10|^3|^4",
"league/html-to-markdown": "^5.0",
"phpdocumentor/reflection-docblock": "^5.2|^6.0",
"phpdocumentor/reflection-docblock": "^5.2",
"symfony/asset": "^7.4|^8.0",
"symfony/asset-mapper": "^7.4|^8.0",
"symfony/console": "^7.4|^8.0",
@@ -3982,7 +3982,7 @@
"description": "Provides integration for Twig with various Symfony components",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/twig-bridge/tree/v8.0.6"
"source": "https://github.com/symfony/twig-bridge/tree/v8.0.5"
},
"funding": [
{
@@ -4002,7 +4002,7 @@
"type": "tidelift"
}
],
"time": "2026-02-25T16:59:43+00:00"
"time": "2026-01-27T09:06:10+00:00"
},
{
"name": "symfony/twig-bundle",
@@ -4090,16 +4090,16 @@
},
{
"name": "symfony/var-dumper",
"version": "v8.0.6",
"version": "v8.0.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "2e14f7e0bf5ff02c6e63bd31cb8e4855a13d6209"
"reference": "326e0406fc315eca57ef5740fa4a280b7a068c82"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/2e14f7e0bf5ff02c6e63bd31cb8e4855a13d6209",
"reference": "2e14f7e0bf5ff02c6e63bd31cb8e4855a13d6209",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/326e0406fc315eca57ef5740fa4a280b7a068c82",
"reference": "326e0406fc315eca57ef5740fa4a280b7a068c82",
"shasum": ""
},
"require": {
@@ -4153,7 +4153,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v8.0.6"
"source": "https://github.com/symfony/var-dumper/tree/v8.0.4"
},
"funding": [
{
@@ -4173,7 +4173,7 @@
"type": "tidelift"
}
],
"time": "2026-02-15T10:53:29+00:00"
"time": "2026-01-01T23:07:29+00:00"
},
{
"name": "symfony/var-exporter",

View File

@@ -246,6 +246,16 @@ class Migrate extends Command
$table->json('promotions')->nullable();
});
}
if (!Capsule::schema()->hasColumn('prices', 'conversionRate')) {
Capsule::schema()->table('prices', function (Blueprint $table) {
$table->float('conversionRate')->nullable();
});
}
if (!Capsule::schema()->hasColumn('products', 'conversionRate')) {
Capsule::schema()->table('products', function (Blueprint $table) {
$table->float('conversionRate')->nullable();
});
}
}
public function index(): void

View File

@@ -23,15 +23,17 @@ class ScrapeWebsite extends Command
{
const COUNTRY_ID = 'country';
private Client $client;
private array $rates;
public function __construct(protected Capsule $database)
{
parent::__construct();
$this->client = new Client();
$this->rates = $this->getCurrencyExchange();
}
protected function configure(): void
{
$this->client = new Client();
$this->addOption(self::COUNTRY_ID, 'c', InputOption::VALUE_OPTIONAL, 'Country id');
}
@@ -68,6 +70,7 @@ class ScrapeWebsite extends Command
$product->priceLowest = $product->lowestPrice->price;
$product->lastSeen = $newestPrice->created_at->format('Y-m-d');
$product->stock = $currentStock->stock;
$product->conversionRate = $newestPrice->conversionRate;
$product->save(['timestamps' => false]);
$progress->advance();
}
@@ -98,7 +101,7 @@ class ScrapeWebsite extends Command
$products = array_merge($products, $responseObject->products);
$page++;
$canLoadMore = $responseObject->canLoadMore;
} catch (GuzzleException $e) {
} catch (GuzzleException) {
return $products;
}
} while ($canLoadMore);
@@ -132,6 +135,7 @@ class ScrapeWebsite extends Command
$price->price = $product->productPrice;
$price->productStandardPrice = $product->productStandardPrice;
$price->lowestProductPrice30Days = $product->lowestProductPrice30Days;
$price->conversionRate = $this->getConversionRate($country->currency);
$productModel->price()->save($price);
}
$stockExist = $productModel->stock()->whereRaw("strftime('%Y-%m-%d', created_at) = ?", [date('Y-m-d')])->exists();
@@ -147,4 +151,22 @@ class ScrapeWebsite extends Command
$productModel->stock()->save($stock);
}
}
public function getCurrencyExchange(): array
{
$result = $this->client->request('GET', 'https://api.nbp.pl/api/exchangerates/tables/A/?format=json');
$rates = ['PLN' => 1.0];
foreach(json_decode($result->getBody()->getContents(),true)[0]['rates'] as $rate){
$rates[$rate['code']] = $rate['mid'];
}
return $rates;
}
private function getConversionRate(string $currency): float
{
$currency = strtoupper($currency);
return $this->rates[$currency];
}
}

View File

@@ -7,9 +7,13 @@ use Krzysiej\RyobiCrawler\Twig\AppExtension;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Bundle\TwigBundle\TwigBundle;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Twig\Extra\Cache\CacheExtension;
use Twig\Extra\Cache\CacheRuntime;
use Twig\Extra\TwigExtraBundle\TwigExtraBundle;
class Kernel extends BaseKernel

View File

@@ -9,6 +9,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
* @property float $price
* @property float $productStandardPrice
* @property float $lowestProductPrice30Days
* @property float $conversionRate
*/
class Price extends Model
{

View File

@@ -27,6 +27,7 @@ use function Symfony\Component\Clock\now;
* @property float $priceLowest
* @property float $productStandardPrice
* @property float $lowestProductPrice30Days
* @property float $conversionRate
* @property Date $lastSeen
* @property integer $stock
* @property Object $promotions
@@ -103,6 +104,11 @@ class Product extends Model
);
}
public function conversionRate(): ?float
{
return $this->conversionRate;
}
public function isDiscontinued(): bool
{
return $this->lastSeen < now()->format('Y-m-d');

View File

@@ -1,9 +0,0 @@
<div class="container">
<footer class="d-flex flex-wrap justify-content-between align-items-center py-3 my-4 border-top">
<div class="col-md-4 d-flex align-items-center">
<span class="mb-3 mb-md-0 text-body-secondary">© 2025 Company, Inc</span>
<a class="align-items-center text-decoration-none" data-bs-theme-value="light">☀️ Light</a>
<a class="align-items-center text-decoration-none" data-bs-theme-value="dark">🌕 Dark</a>
</div>
</footer>
</div>

View File

@@ -11,7 +11,8 @@
<td>
<a href='{{ path('app_product', {'productId': product.id}) }}'
class="text-decoration-none">{{ product.name }}</a>
<a href="{{ path('app_search', {'search': product.subTitle}) }}"><span class="badge text-bg-secondary">{{ product.subTitle }}</span></a>
<span class="badge text-bg-light"><a href="{{ path('app_search', {'search': product.subTitle}) }}"
class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
{% if product.promotions is not null and product.promotions.hasPromotion %}<a
href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span>
</a>{% endif %}

View File

@@ -48,19 +48,22 @@
class="text-decoration-none">{{ product.name }}</a>
<br>
{% if product.stock > 0 %}
<span class="badge text-bg-secondary">stock: {{ product.stock }}</span>
<span class="badge text-bg-light">stock: {{ product.stock }}</span>
{% else %}
<span class="badge text-bg-warning">out of stock</span>
{% endif %}
{% if product.isDiscontinued() %}
<a href="{{ path('app_discontinued') }}"><span class="badge text-bg-secondary" data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span></a>
<a href="{{ path('app_discontinued') }}"><span class="badge text-bg-secondary" data-bs-toggle="tooltip"
data-bs-title="Last update: {{ product.lastSeen }}">is discontinued</span></a>
{% endif %}
{% if product.isNew() %}
<a href="{{ path('app_new') }}"><span class="badge text-bg-success">is new</span></a>
{% endif %}
<a href="{{ path('app_search', {'search': product.subTitle}) }}"><span class="badge text-bg-secondary">{{ product.subTitle }}</span></a>
<span class="badge text-bg-light"><a
href="{{ path('app_search', {'search': product.subTitle}) }}"
class="link-underline link-underline-opacity-0 link-dark">{{ product.subTitle }}</a></span>
{% if product.promotions is not null and product.promotions.hasPromotion %}<a href="{{ path('app_promos', {'promo': product.promotions.slug}) }}"><span class="badge bg-info">PROMO: {{ product.promotions.tag }}</span></a>{% endif %}
<span class="badge text-bg-secondary">{{ product.country.countryName }}</span>
<span class="badge text-bg-light">{{ product.country.countryName }}</span>
</td>
<td class="align-middle">
<nav aria-label="breadcrumb" style="--bs-breadcrumb-divider: '>';">
@@ -77,19 +80,30 @@
<td class="align-middle"><a href='https://{{ product.country.locale }}.ryobitools.eu{{ product.url }}'>link</a></td>
<td class="align-middle text-end">
{% if product.isDiscontinued() or product.priceCurrent == product.productStandardPrice %}
{{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}
{{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}<br>
{% if product.conversionRate is not empty and product.conversionRate != 1 %}
{{ (product.priceLowest * product.conversionRate) | format_currency('PLN', {}, 'pl') }}
{% endif %}
{% else %}
{% if product.priceLowest != product.priceCurrent %}{{ product.priceLowest | format_currency(product.country.currency, {}, product.country.locale) }}{% else %}
<span class="badge text-bg-info">now lowest</span>{% endif %}</td>
<span class="badge text-bg-info">now lowest</span>
{% endif %}</td>
{% endif %}
<td class="align-middle text-end">{{ product.priceCurrent | format_currency(product.country.currency, {}, product.country.locale) }}</td>
<td class="align-middle text-end">
{{ product.priceCurrent | format_currency(product.country.currency, {}, product.country.locale) }}<br>
{% if product.conversionRate is not empty and product.conversionRate != 1 %}
{{ (product.priceCurrent * product.conversionRate) | format_currency('PLN', {}, 'pl') }}
{% endif %}
</td>
<td class="align-middle">
<div class="d-flex flex-row">
{% if product.priceCurrent != product.productStandardPrice %}<span
class="badge text-bg-warning text-decoration-line-through flex-fill">{{ product.productStandardPrice | format_currency(product.country.currency, {}, product.country.locale) }}</span>
<span
class="badge text-bg-success flex-fill">{{ ((1 - product.priceCurrent / product.productStandardPrice)*100)|number_format(0) }}%</span>
{% if product.priceCurrent != product.productStandardPrice %}
<span class="badge text-bg-warning text-decoration-line-through flex-fill">{{ product.productStandardPrice | format_currency(product.country.currency, {}, product.country.locale) }}</span>
{% if product.conversionRate is not empty and product.conversionRate != 1 %}
<span class="badge text-bg-warning text-decoration-line-through flex-fill">{{ (product.productStandardPrice * product.conversionRate) | format_currency('PLN', {}, 'pl') }}</span>
{% endif %}
<span class="badge text-bg-success flex-fill">{{ ((1 - product.priceCurrent / product.productStandardPrice)*100)|number_format(0) }}%</span>
{% endif %}
</div>
</td>

View File

@@ -1,75 +1,6 @@
<!doctype html>
<html lang="en" data-bs-theme="">
<html lang="en" data-bs-theme="light">
<head>
<script>
(() => {
'use strict'
const getStoredTheme = () => localStorage.getItem('theme')
const setStoredTheme = theme => localStorage.setItem('theme', theme)
const getPreferredTheme = () => {
const storedTheme = getStoredTheme()
if (storedTheme) {
return storedTheme
}
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
}
const setTheme = theme => {
if (theme === 'auto') {
document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
} else {
document.documentElement.setAttribute('data-bs-theme', theme)
}
}
setTheme(getPreferredTheme())
const showActiveTheme = (theme, focus = false) => {
const themeSwitcher = document.querySelector('#bd-theme')
if (!themeSwitcher) {
return
}
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
element.classList.remove('active')
})
btnToActive.classList.add('active')
if (focus) {
themeSwitcher.focus()
}
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
const storedTheme = getStoredTheme()
if (storedTheme !== 'light' && storedTheme !== 'dark') {
setTheme(getPreferredTheme())
}
})
window.addEventListener('DOMContentLoaded', () => {
showActiveTheme(getPreferredTheme())
document.querySelectorAll('[data-bs-theme-value]')
.forEach(toggle => {
toggle.addEventListener('click', () => {
const theme = toggle.getAttribute('data-bs-theme-value')
setStoredTheme(theme)
setTheme(theme)
showActiveTheme(theme, true)
})
})
})
})()
</script>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
@@ -82,8 +13,7 @@
<div class="container-fluid">
<a class="navbar-brand" href="{{ path('app_home') }}">Crawler</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"
aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
@@ -115,7 +45,6 @@
</nav>
{% block content %}{% endblock %}
{{ include('footer.html.twig') }}
<script src="/templates/js/bootstrap.bundle.min.js"></script>
</body>
</html>