- Ajoute DeleteContentSourceCommand + CommandHandler (CQRS)
- Expose DELETE /api/content-sources/{id} via API Platform (Resource, Provider, Processor)
- Ajoute 2 tests Feature (204 succès, 404 not found)
- Frontend : méthode delete() dans le repository, action deleteSource() dans le store
- Nouveau composant ContentSourceDeleteModal (modale de confirmation)
- Bouton Supprimer dans la toolbar de ScrapperEdit (visible en mode édition uniquement)
51 lines
1.6 KiB
PHP
51 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Domain\Setting\Infrastructure\ApiPlatform\Resource;
|
|
|
|
use ApiPlatform\Metadata\ApiResource;
|
|
use ApiPlatform\Metadata\Delete;
|
|
use App\Domain\Setting\Infrastructure\ApiPlatform\State\Processor\DeleteContentSourceStateProcessor;
|
|
use App\Domain\Setting\Infrastructure\ApiPlatform\State\Provider\DeleteContentSourceStateProvider;
|
|
|
|
#[ApiResource(
|
|
shortName: 'ContentSource',
|
|
operations: [
|
|
new Delete(
|
|
uriTemplate: '/content-sources/{id}',
|
|
provider: DeleteContentSourceStateProvider::class,
|
|
processor: DeleteContentSourceStateProcessor::class,
|
|
name: 'delete_content_source',
|
|
openapiContext: [
|
|
'summary' => 'Delete a content source',
|
|
'description' => 'Permanently deletes a content source',
|
|
'parameters' => [
|
|
[
|
|
'name' => 'id',
|
|
'in' => 'path',
|
|
'required' => true,
|
|
'schema' => [
|
|
'type' => 'integer'
|
|
],
|
|
'description' => 'The content source ID'
|
|
]
|
|
],
|
|
'responses' => [
|
|
'204' => [
|
|
'description' => 'Content source successfully deleted'
|
|
],
|
|
'404' => [
|
|
'description' => 'Content source not found'
|
|
]
|
|
]
|
|
]
|
|
)
|
|
]
|
|
)]
|
|
class DeleteContentSourceResource
|
|
{
|
|
public function __construct(
|
|
public int $id
|
|
) {
|
|
}
|
|
}
|