mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-07-31 05:31:47 +00:00
Reworked info provider system to merge all provider metadata into a unified DTO
This commit is contained in:
parent
661cc5a052
commit
071ffe322d
39 changed files with 412 additions and 533 deletions
|
|
@ -25,6 +25,7 @@ namespace App\Services\InfoProviderSystem\Providers;
|
|||
|
||||
use App\Services\InfoProviderSystem\DTOs\FileDTO;
|
||||
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
||||
use App\Services\InfoProviderSystem\DTOs\ProviderInfoDTO;
|
||||
use App\Services\InfoProviderSystem\DTOs\SearchResultDTO;
|
||||
use Symfony\Component\DependencyInjection\Attribute\When;
|
||||
|
||||
|
|
@ -34,19 +35,20 @@ use Symfony\Component\DependencyInjection\Attribute\When;
|
|||
#[When(env: 'test')]
|
||||
class EmptyProvider implements InfoProviderInterface
|
||||
{
|
||||
public function getProviderInfo(): array
|
||||
{
|
||||
return [
|
||||
'name' => 'Empty Provider',
|
||||
'description' => 'This is a test provider',
|
||||
//'url' => 'https://example.com',
|
||||
'disabled_help' => 'This provider is disabled for testing purposes'
|
||||
];
|
||||
}
|
||||
public const PROVIDER_KEY = 'empty';
|
||||
|
||||
public function getProviderKey(): string
|
||||
public function getProviderInfo(): ProviderInfoDTO
|
||||
{
|
||||
return 'empty';
|
||||
return new ProviderInfoDTO(
|
||||
key: self::PROVIDER_KEY,
|
||||
name: 'Empty Provider',
|
||||
description: 'This is a test provider',
|
||||
disabledHelp: 'This provider is disabled for testing purposes',
|
||||
capabilities: [
|
||||
ProviderCapabilities::BASIC,
|
||||
ProviderCapabilities::FOOTPRINT,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
|
|
@ -61,14 +63,6 @@ class EmptyProvider implements InfoProviderInterface
|
|||
];
|
||||
}
|
||||
|
||||
public function getCapabilities(): array
|
||||
{
|
||||
return [
|
||||
ProviderCapabilities::BASIC,
|
||||
ProviderCapabilities::FOOTPRINT,
|
||||
];
|
||||
}
|
||||
|
||||
public function getDetails(string $id, array $options = []): PartDetailDTO
|
||||
{
|
||||
throw new \RuntimeException('No part details available');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue