A documentation section has been added to the site.

This commit is contained in:
2024-05-19 19:47:02 +05:00
parent 42701a24db
commit e74456ee2f
35 changed files with 766 additions and 34 deletions
@@ -5,6 +5,7 @@ namespace App\Services\Admin\Project;
use App\Dto\QuerySettingsDto;
use App\Dto\Builder\DocumentationVersion as DocumentationVersionBuilderDto;
use App\Dto\Service\Admin\Project\DocumentationVersion\StoreUpdate;
use App\Enums\CacheTag;
use App\Enums\DocumentationVersionStatus;
use App\Models\DocumentationVersion;
use App\Models\User;
@@ -14,6 +15,7 @@ use App\ServiceResults\ServiceResultArray;
use App\ServiceResults\ServiceResultError;
use App\ServiceResults\ServiceResultSuccess;
use App\ServiceResults\StoreUpdateResult;
use App\Services\ClearCacheCommandHandler;
use App\Services\DocumentationVersion\DocumentationVersionCommandHandler;
use App\Services\Service;
use Illuminate\Support\Facades\DB;
@@ -24,6 +26,7 @@ final class DocumentationVersionService extends Service
private readonly ProjectRepository $projectRepository,
private readonly DocumentationVersionRepository $documentationVersionRepository,
private readonly DocumentationVersionCommandHandler $documentationVersionCommandHandler,
private readonly ClearCacheCommandHandler $clearCacheCommandHandler,
) { }
public function index(int $projectId, DocumentationVersionBuilderDto $documentationVersionBuilderDto, QuerySettingsDto $querySettingsDto, User $user): ServiceResultError | ServiceResultArray
@@ -138,6 +141,7 @@ final class DocumentationVersionService extends Service
$dataVersion = $this->getDataVersion($data);
return $this->documentationVersionCommandHandler->handleStore($project, $dataVersion);
});
$this->clearCacheCommandHandler->byTag(CacheTag::DocumantationVersion);
} catch (\Throwable $e) {
report($e);
return $this->errService(__('Server Error'));
@@ -174,6 +178,7 @@ final class DocumentationVersionService extends Service
$dataVersion = $this->getDataVersion($data);
return $this->documentationVersionCommandHandler->handleUpdate($version, $dataVersion);
});
$this->clearCacheCommandHandler->byTag(CacheTag::DocumantationVersion);
} catch (\Throwable $e) {
report($e);
return $this->errService(__('Server Error'));
@@ -202,6 +207,7 @@ final class DocumentationVersionService extends Service
DB::transaction(function () use ($version) {
$this->documentationVersionCommandHandler->handleDestroy($version);
});
$this->clearCacheCommandHandler->byTag(CacheTag::DocumantationVersion);
} catch (\Throwable $e) {
report($e);
return $this->errService(__('Server Error'));