From 1fb7b6f69bc03d15ae21496f0e866f753b867c85 Mon Sep 17 00:00:00 2001 From: Ahmed Darrazi Date: Tue, 16 Dec 2025 21:17:49 +0100 Subject: [PATCH] bugfixes --- Dockerfile | 2 +- .../Exam/app/Services/ExamResourceService.php | 83 ------------------- 2 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 Modules/Exam/app/Services/ExamResourceService.php diff --git a/Dockerfile b/Dockerfile index 422ad8c5..8ab903aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -156,4 +156,4 @@ HEALTHCHECK --interval=60s --timeout=10s --start-period=30s --retries=5 \ CMD curl -f http://localhost:80/health || curl -f http://localhost:80/test.php || exit 1 # Start supervisor -CMD ["sh", "-c", "mkdir -p storage/framework/cache storage/framework/sessions storage/framework/views storage/logs bootstrap/cache && chown -R www-data:www-data storage bootstrap/cache && chmod -R 775 storage bootstrap/cache && if [ -f .env ]; then chmod 666 .env; fi && php artisan optimize:clear && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] +CMD ["sh", "-c", "mkdir -p storage/framework/cache storage/framework/sessions storage/framework/views storage/logs bootstrap/cache && chown -R www-data:www-data storage bootstrap/cache && chmod -R 775 storage bootstrap/cache && touch storage/installed public/installed && if [ -f .env ]; then chmod 666 .env || true; fi && php artisan optimize:clear && /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf"] diff --git a/Modules/Exam/app/Services/ExamResourceService.php b/Modules/Exam/app/Services/ExamResourceService.php deleted file mode 100644 index 11878d3c..00000000 --- a/Modules/Exam/app/Services/ExamResourceService.php +++ /dev/null @@ -1,83 +0,0 @@ -uploaderService = config('filesystems.default') === 's3' ? new S3MultipartUploadService() : new LocalFileUploadService(); - } - - public function resourceStore(array $data): ExamResource - { - if ($data['type'] === 'link') { - $resource = ExamResource::create($data); - } else { - $resource = ExamResource::create([...$data, 'resource' => $data['resource_url']]); - } - - return $resource; - } - - public function resourceUpdate(ExamResource $resource, array $data): bool - { - if ($data['type'] === 'link') { - $resource->update($data); - } else { - $chunkedUpload = ChunkedUpload::where('file_url', $data['resource'])->first(); - $chunkedUpload && $this->uploaderService->deleteFile($chunkedUpload); - - $resource->update([...$data, 'resource' => $data['resource_url']]); - } - - return true; - } - - public function resourceDelete(ExamResource $resource): bool - { - $chunkedUpload = ChunkedUpload::where('file_url', $resource->resource)->first(); - $chunkedUpload && $this->uploaderService->deleteFile($chunkedUpload); - - $resource->delete(); - - return true; - } - - public function getExamResources(string $exam_id) - { - $exam = Exam::find($exam_id); - if (!$exam) { - return []; - } - - // Get media files from Spatie Media Library - $media = $exam->getMedia('resources'); - - if (!$media) { - return []; - } - - // Convert media collection to array format - return $media->map(function ($item) { - return [ - 'id' => $item->id, - 'name' => $item->name, - 'file_name' => $item->file_name, - 'mime_type' => $item->mime_type, - 'size' => $item->size, - 'url' => $item->getUrl(), - 'getUrl' => $item->getUrl(), - ]; - })->toArray(); - } -}