From f05521f1d48c8e8de71172f0b872e2855464f18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Wis=CC=81niewski?= Date: Tue, 27 Jan 2026 09:00:57 +0100 Subject: [PATCH 1/6] Added signed_urls to redis --- src/Enum/ConstantEnum.php | 2 ++ src/Services/ConsultationService.php | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/Enum/ConstantEnum.php b/src/Enum/ConstantEnum.php index 5289a09..78dedaf 100644 --- a/src/Enum/ConstantEnum.php +++ b/src/Enum/ConstantEnum.php @@ -8,4 +8,6 @@ class ConstantEnum extends Enum { public const PER_PAGE = 15; public const DIRECTORY = 'consultation'; + public const REDIS_IMAGES_KEY = 'signed_urls_index'; + public const REDIS_IMAGES_TTL = 300; } diff --git a/src/Services/ConsultationService.php b/src/Services/ConsultationService.php index 2efc696..4a8ff86 100644 --- a/src/Services/ConsultationService.php +++ b/src/Services/ConsultationService.php @@ -51,6 +51,7 @@ use Illuminate\Http\UploadedFile; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Storage; use Illuminate\Support\Str; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -631,6 +632,11 @@ public function generateSignedScreenUrls(GenerateSignedScreenUrlsDto $dto): arra return array_map(function ($file) use ($directory) { $filename = $file['filename']; + $key = 'signed_urls:' . md5($directory); + Redis::command('SETEX', [$key, ConstantEnum::REDIS_IMAGES_TTL, $directory . $filename]); + Redis::command('HSET', [ConstantEnum::REDIS_IMAGES_KEY, $key, 1]); + Redis::command('EXPIRE', [ConstantEnum::REDIS_IMAGES_KEY, ConstantEnum::REDIS_IMAGES_TTL]); + return array_merge( ['filename' => $filename], Storage::temporaryUploadUrl($directory . $filename, now()->addMinutes(5)) From a04c35e1deb3162f2219a0f6f15a98bcde1f8da7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Wis=CC=81niewski?= Date: Tue, 27 Jan 2026 09:27:10 +0100 Subject: [PATCH 2/6] fix tests --- src/Services/ConsultationService.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Services/ConsultationService.php b/src/Services/ConsultationService.php index 4a8ff86..44048b1 100644 --- a/src/Services/ConsultationService.php +++ b/src/Services/ConsultationService.php @@ -632,10 +632,12 @@ public function generateSignedScreenUrls(GenerateSignedScreenUrlsDto $dto): arra return array_map(function ($file) use ($directory) { $filename = $file['filename']; - $key = 'signed_urls:' . md5($directory); - Redis::command('SETEX', [$key, ConstantEnum::REDIS_IMAGES_TTL, $directory . $filename]); - Redis::command('HSET', [ConstantEnum::REDIS_IMAGES_KEY, $key, 1]); - Redis::command('EXPIRE', [ConstantEnum::REDIS_IMAGES_KEY, ConstantEnum::REDIS_IMAGES_TTL]); + if (config('cache.default') === 'redis') { + $key = 'signed_urls:' . md5($directory); + Redis::command('SETEX', [$key, ConstantEnum::REDIS_IMAGES_TTL, $directory . $filename]); + Redis::command('HSET', [ConstantEnum::REDIS_IMAGES_KEY, $key, 1]); + Redis::command('EXPIRE', [ConstantEnum::REDIS_IMAGES_KEY, ConstantEnum::REDIS_IMAGES_TTL]); + } return array_merge( ['filename' => $filename], From 1c893d577f1d69c9f4b65a85a9252937e28250b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Wis=CC=81niewski?= Date: Tue, 27 Jan 2026 10:59:43 +0100 Subject: [PATCH 3/6] fix --- .github/workflows/test-cc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-cc.yml b/.github/workflows/test-cc.yml index 2424a33..c8fd069 100644 --- a/.github/workflows/test-cc.yml +++ b/.github/workflows/test-cc.yml @@ -63,7 +63,7 @@ jobs: run: git config --global safe.directory '*' - name: Convert - run: ./cc-test-reporter format-coverage coverage.xml -t clover -o codeclimate.0.json + run: bash ./cc-test-reporter format-coverage coverage.xml -t clover -o codeclimate.0.json - name: Upload run: ./cc-test-reporter upload-coverage -i codeclimate.0.json From fbbc1ae114c7bb09ebb9be147082be801ef76676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Wis=CC=81niewski?= Date: Tue, 27 Jan 2026 12:08:09 +0100 Subject: [PATCH 4/6] fix --- .github/workflows/test-cc.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-cc.yml b/.github/workflows/test-cc.yml index c8fd069..2424a33 100644 --- a/.github/workflows/test-cc.yml +++ b/.github/workflows/test-cc.yml @@ -63,7 +63,7 @@ jobs: run: git config --global safe.directory '*' - name: Convert - run: bash ./cc-test-reporter format-coverage coverage.xml -t clover -o codeclimate.0.json + run: ./cc-test-reporter format-coverage coverage.xml -t clover -o codeclimate.0.json - name: Upload run: ./cc-test-reporter upload-coverage -i codeclimate.0.json From 55d6ba043d6196aab36e4e284d6212b4b9e5de3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Wis=CC=81niewski?= Date: Fri, 30 Jan 2026 11:35:47 +0100 Subject: [PATCH 5/6] fix --- .github/workflows/test-cc.yml | 1 + src/Services/ConsultationService.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-cc.yml b/.github/workflows/test-cc.yml index 2424a33..0d2559d 100644 --- a/.github/workflows/test-cc.yml +++ b/.github/workflows/test-cc.yml @@ -63,6 +63,7 @@ jobs: run: git config --global safe.directory '*' - name: Convert + shell: bash run: ./cc-test-reporter format-coverage coverage.xml -t clover -o codeclimate.0.json - name: Upload diff --git a/src/Services/ConsultationService.php b/src/Services/ConsultationService.php index 44048b1..a18e327 100644 --- a/src/Services/ConsultationService.php +++ b/src/Services/ConsultationService.php @@ -633,7 +633,7 @@ public function generateSignedScreenUrls(GenerateSignedScreenUrlsDto $dto): arra $filename = $file['filename']; if (config('cache.default') === 'redis') { - $key = 'signed_urls:' . md5($directory); + $key = 'signed_urls:' . md5($directory . $filename); Redis::command('SETEX', [$key, ConstantEnum::REDIS_IMAGES_TTL, $directory . $filename]); Redis::command('HSET', [ConstantEnum::REDIS_IMAGES_KEY, $key, 1]); Redis::command('EXPIRE', [ConstantEnum::REDIS_IMAGES_KEY, ConstantEnum::REDIS_IMAGES_TTL]); From 5c3351d86e7d6db1e12bc093e55d81a5ef3a815b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Witold=20Wis=CC=81niewski?= Date: Fri, 30 Jan 2026 11:58:44 +0100 Subject: [PATCH 6/6] fix --- .github/workflows/test-cc.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-cc.yml b/.github/workflows/test-cc.yml index 0d2559d..16487b0 100644 --- a/.github/workflows/test-cc.yml +++ b/.github/workflows/test-cc.yml @@ -55,18 +55,18 @@ jobs: - name: codecov upload uses: codecov/codecov-action@v1 - - name: Setup Code Climate test-reporter - run: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - - name: SafeDirFix - run: git config --global safe.directory '*' - - - name: Convert - shell: bash - run: ./cc-test-reporter format-coverage coverage.xml -t clover -o codeclimate.0.json - - - name: Upload - run: ./cc-test-reporter upload-coverage -i codeclimate.0.json - env: - CC_TEST_REPORTER_ID: 004a62af5e00aac588594d19de2be2e6c6d0844332c6a5a4f54b7fdfb00e0798 +# - name: Setup Code Climate test-reporter +# run: | +# curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter +# chmod +x ./cc-test-reporter +# - name: SafeDirFix +# run: git config --global safe.directory '*' +# +# - name: Convert +# shell: bash +# run: ./cc-test-reporter format-coverage coverage.xml -t clover -o codeclimate.0.json +# +# - name: Upload +# run: ./cc-test-reporter upload-coverage -i codeclimate.0.json +# env: +# CC_TEST_REPORTER_ID: 004a62af5e00aac588594d19de2be2e6c6d0844332c6a5a4f54b7fdfb00e0798