Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions .github/workflows/test-cc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +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
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
2 changes: 2 additions & 0 deletions src/Enum/ConstantEnum.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
8 changes: 8 additions & 0 deletions src/Services/ConsultationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -631,6 +632,13 @@ public function generateSignedScreenUrls(GenerateSignedScreenUrlsDto $dto): arra
return array_map(function ($file) use ($directory) {
$filename = $file['filename'];

if (config('cache.default') === 'redis') {
$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]);
}

return array_merge(
['filename' => $filename],
Storage::temporaryUploadUrl($directory . $filename, now()->addMinutes(5))
Expand Down