Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"@coderabbitai summary"
@coderabbitai summary

Thanks for contributing to phpList!
28 changes: 14 additions & 14 deletions src/Subscription/Controller/SubscriberAttributeValueController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

#[Route('/subscribers/attribute-values', name: 'subscriber_attribute_value_')]
#[Route('/subscribers', name: 'subscriber_attribute_value_')]
class SubscriberAttributeValueController extends BaseController
{
private SubscriberAttributeManager $attributeManager;
Expand All @@ -44,16 +44,16 @@ public function __construct(
}

#[Route(
path: '/{subscriberId}/{definitionId}',
path: '/{subscriberId}/attributes/{definitionId}',
name: 'create',
requirements: ['subscriberId' => '\d+', 'definitionId' => '\d+'],
methods: ['POST', 'PUT']
)]
#[OA\Post(
path: '/api/v2/subscribers/attribute-values/{subscriberId}/{definitionId}',
path: '/api/v2/subscribers/{subscriberId}/attributes/{definitionId}',
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
'Returns created/updated subscriber attribute.',
summary: 'Create/update a subscriber attribute.',
summary: 'Create/update a subscriber attribute value.',
requestBody: new OA\RequestBody(
description: 'Pass parameters to create subscriber attribute.',
required: true,
Expand Down Expand Up @@ -130,13 +130,13 @@ public function createOrUpdate(
}

#[Route(
path: '/{subscriberId}/{definitionId}',
path: '/{subscriberId}/attributes/{definitionId}',
name: 'delete',
requirements: ['subscriberId' => '\d+', 'definitionId' => '\d+'],
methods: ['DELETE']
)]
#[OA\Delete(
path: '/api/v2/subscribers/attribute-values/{subscriberId}/{definitionId}',
path: '/api/v2/subscribers/{subscriberId}/attributes/{definitionId}',
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
'Deletes a single subscriber attribute.',
summary: 'Deletes an attribute.',
Expand Down Expand Up @@ -200,9 +200,9 @@ public function delete(
return $this->json(null, Response::HTTP_NO_CONTENT);
}

#[Route('/{subscriberId}', name: 'get_list', requirements: ['subscriberId' => '\d+'], methods: ['GET'])]
#[Route('/{subscriberId}/attributes', name: 'get_list', requirements: ['subscriberId' => '\d+'], methods: ['GET'])]
#[OA\Get(
path: '/api/v2/subscribers/attribute-values/{subscriberId}',
path: '/api/v2/subscribers/{subscriberId}/attributes',
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
'Returns a JSON list of all subscriber attributes.',
summary: 'Gets a list of all subscriber attributes.',
Expand Down Expand Up @@ -270,23 +270,23 @@ public function getPaginated(

return $this->json(
$this->paginatedDataProvider->getPaginatedList(
$request,
$this->normalizer,
SubscriberAttributeValue::class,
$filter
request: $request,
normalizer: $this->normalizer,
className: SubscriberAttributeValue::class,
filter: $filter
),
Response::HTTP_OK
);
}

#[Route(
path: '/{subscriberId}/{definitionId}',
path: '/{subscriberId}/attributes/{definitionId}',
name: 'get_one',
requirements: ['subscriberId' => '\d+', 'definitionId' => '\d+'],
methods: ['GET']
)]
#[OA\Get(
path: '/api/v2/subscribers/attribute-values/{subscriberId}/{definitionId}',
path: '/api/v2/subscribers/{subscriberId}/attributes/{definitionId}',
description: '🚧 **Status: Beta** – This method is under development. Avoid using in production. ' .
'Returns a single attribute.',
summary: 'Gets subscriber attribute.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

class SubscriberAttributeValueControllerTest extends AbstractTestController
{

public function testControllerIsAvailableViaContainer(): void
{
self::assertInstanceOf(
Expand All @@ -34,7 +33,7 @@ public function testCreateOrUpdateAttributeValue(): void

$this->authenticatedJsonRequest(
'post',
'/api/v2/subscribers/attribute-values/' . $subscriberId . '/' . $definitionId,
'/api/v2/subscribers/' . $subscriberId . '/attributes/' . $definitionId,
[],
[],
[],
Expand All @@ -55,7 +54,7 @@ public function testDeleteAttributeValue(): void

$this->authenticatedJsonRequest(
'delete',
'/api/v2/subscribers/attribute-values/1/1'
'/api/v2/subscribers/1/attributes/1'
);

$this->assertHttpNoContent();
Expand All @@ -70,7 +69,7 @@ public function testGetPaginatedAttributes(): void

$this->authenticatedJsonRequest(
'get',
'/api/v2/subscribers/attribute-values/1'
'/api/v2/subscribers/1/attributes'
);

$this->assertHttpOkay();
Expand All @@ -83,7 +82,7 @@ public function testAttributeValueNotFoundReturns404(): void
{
$this->authenticatedJsonRequest(
'get',
'/api/v2/subscribers/attribute-values/999/999'
'/api/v2/subscribers/999/attributes/999'
);

$this->assertHttpNotFound();
Expand Down
Loading