Repository navigation
Add carrier delete, bulk delete and bulk status endpoints - #448
luigimassa wants to merge 1 commit into
Conversation
|
Hello @luigimassa! This is your first pull request on ps_apiresources repository of the PrestaShop project. Thank you, and welcome to this Open Source community! |
| * @var int[] | ||
| */ | ||
| #[ApiProperty(openapiContext: ['type' => 'array', 'items' => ['type' => 'integer'], 'example' => [1, 3]])] | ||
| #[Assert\NotBlank] |
There was a problem hiding this comment.
Could you merge BulkDeleteCarriers and BulkUpdateStatusCarriers into one BulkCarriers class, like BulkCountries, and validate the ids with Assert\All([new Assert\Type('integer'), new Assert\Positive()])? With NotBlank alone, [0] or ["a"] reaches the command.
There was a problem hiding this comment.
Done: one BulkCarriers class for both operations, like BulkCountries. The ids are validated with Assert\All([new Assert\Type('integer'), new Assert\Positive()]), so [0] and ["a"] answer 422 before the command runs (both covered by the test). I also added the OpenAPI summary and description of each operation.
- DELETE /carriers/{carrierId}
- PUT /carriers/bulk-update-status
- DELETE /carriers/bulk-delete
Both bulk operations share one BulkCarriers resource, like BulkCountries. The carrier ids are
validated as positive integers before the command runs (422), unknown ones answer 404.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fd47033 to
58c7557
Compare
|
About #302: I asked there whether it can be closed in favour of this one, since this PR also covers the single delete and the bulk status. |
|
PrestaShop/PrestaShop#43369 (9.2.1) reads the item type of an array from its
On older cores the arrays are documented without item type, the behaviour is the same. Keep the |
|
Thanks @jolelievre! I'll drop the |
CarrierStatusAndDeleteEndpointTest(CI)Replaces #147, #148, #159 and #160. Since they were opened,
devgained the carrier GET / create / update / ranges / list endpoints, so this PR only adds what is still missing, rebased on the currentdevand following the review of #160:DELETE /carriers/{carrierId}(DeleteCarrierCommand)PUT /carriers/bulk-update-statuswithcarrierIds+enabled(BulkToggleCarrierStatusCommand)DELETE /carriers/bulk-deletewithcarrierIds(BulkDeleteCarrierCommand)Both bulk operations share one
BulkCarriersresource, likeBulkCountries. The ids are validated as positive integers, so[0]or["a"]answer 422 before the command runs; emptycarrierIdsare rejected too. Unknown carriers answer 404.The single carrier toggle endpoints of the previous PRs were dropped: the existing carrier update already sets
enabledandfreeand returns the carrier.Tests compare whole objects and cover the protected endpoints and the invalid payloads. Checked locally on PrestaShop 9.2.0: all
Carrier*integration tests, PHPStan (phpstan-9.2.x.neon), PHP-CS-Fixer and Rector.🤖 Generated with Claude Code