-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35172 from tleon/Issue-35127-clean-core-from-endp…
…oints Delete endpoints that have been moved to the module
- Loading branch information
Showing
21 changed files
with
78 additions
and
1,478 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,8 @@ | |
} | ||
} | ||
} | ||
|
||
.resource-scopes-not-available { | ||
padding-top: calc(0.375rem + 1px); | ||
text-align: left; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
118 changes: 0 additions & 118 deletions
118
src/PrestaShopBundle/ApiPlatform/Resources/CustomerGroup.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +0,0 @@ | ||
<?php | ||
|
||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@prestashop.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <contact@prestashop.com> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PrestaShopBundle\ApiPlatform\Resources; | ||
|
||
use ApiPlatform\Metadata\ApiProperty; | ||
use ApiPlatform\Metadata\ApiResource; | ||
use PrestaShop\PrestaShop\Core\Domain\Customer\Group\Command\AddCustomerGroupCommand; | ||
use PrestaShop\PrestaShop\Core\Domain\Customer\Group\Command\DeleteCustomerGroupCommand; | ||
use PrestaShop\PrestaShop\Core\Domain\Customer\Group\Command\EditCustomerGroupCommand; | ||
use PrestaShop\PrestaShop\Core\Domain\Customer\Group\Exception\GroupNotFoundException; | ||
use PrestaShop\PrestaShop\Core\Domain\Customer\Group\Query\GetCustomerGroupForEditing; | ||
use PrestaShopBundle\ApiPlatform\Metadata\CQRSCreate; | ||
use PrestaShopBundle\ApiPlatform\Metadata\CQRSDelete; | ||
use PrestaShopBundle\ApiPlatform\Metadata\CQRSGet; | ||
use PrestaShopBundle\ApiPlatform\Metadata\CQRSUpdate; | ||
|
||
#[ApiResource( | ||
operations: [ | ||
new CQRSGet( | ||
uriTemplate: '/customers/group/{customerGroupId}', | ||
CQRSQuery: GetCustomerGroupForEditing::class, | ||
scopes: [ | ||
'customer_group_read', | ||
], | ||
// QueryResult format doesn't match with ApiResource, so we can specify a mapping so that it is normalized with extra fields adapted for the ApiResource DTO | ||
CQRSQueryMapping: [ | ||
// EditableCustomerGroup::$id is normalized as [customerGroupId] | ||
'[id]' => '[customerGroupId]', | ||
// EditableCustomerGroup::$reduction is normalized as [reductionPercent] | ||
'[reduction]' => '[reductionPercent]', | ||
], | ||
), | ||
new CQRSCreate( | ||
uriTemplate: '/customers/group', | ||
CQRSCommand: AddCustomerGroupCommand::class, | ||
CQRSQuery: GetCustomerGroupForEditing::class, | ||
scopes: [ | ||
'customer_group_write', | ||
], | ||
// Here, we use query mapping to adapt normalized query result for the ApiPlatform DTO | ||
CQRSQueryMapping: [ | ||
'[id]' => '[customerGroupId]', | ||
'[reduction]' => '[reductionPercent]', | ||
], | ||
// Here, we use command mapping to adapt the normalized command result for the CQRS query | ||
CQRSCommandMapping: [ | ||
'[groupId]' => '[customerGroupId]', | ||
], | ||
), | ||
new CQRSUpdate( | ||
uriTemplate: '/customers/group/{customerGroupId}', | ||
CQRSCommand: EditCustomerGroupCommand::class, | ||
CQRSQuery: GetCustomerGroupForEditing::class, | ||
scopes: [ | ||
'customer_group_write', | ||
], | ||
// Here we use the ApiResource DTO mapping to transform the normalized query result | ||
ApiResourceMapping: [ | ||
'[id]' => '[customerGroupId]', | ||
'[reduction]' => '[reductionPercent]', | ||
], | ||
), | ||
new CQRSDelete( | ||
uriTemplate: '/customers/group/{customerGroupId}', | ||
CQRSQuery: DeleteCustomerGroupCommand::class, | ||
scopes: [ | ||
'customer_group_write', | ||
], | ||
// Here, we use query mapping to adapt URI parameters to the expected constructor parameter name | ||
CQRSQueryMapping: [ | ||
'[customerGroupId]' => '[groupId]', | ||
], | ||
), | ||
], | ||
exceptionToStatus: [GroupNotFoundException::class => 404], | ||
)] | ||
class CustomerGroup | ||
{ | ||
#[ApiProperty(identifier: true)] | ||
public int $customerGroupId; | ||
|
||
public array $localizedNames; | ||
|
||
public float $reductionPercent; | ||
|
||
public bool $displayPriceTaxExcluded; | ||
|
||
public bool $showPrice; | ||
|
||
public array $shopIds; | ||
} | ||
108 changes: 0 additions & 108 deletions
108
src/PrestaShopBundle/ApiPlatform/Resources/FoundProduct.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,108 +0,0 @@ | ||
<?php | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@prestashop.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <contact@prestashop.com> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PrestaShopBundle\ApiPlatform\Resources; | ||
|
||
use ApiPlatform\Metadata\ApiProperty; | ||
use ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Metadata\GetCollection; | ||
use PrestaShop\PrestaShop\Core\Domain\Product\Query\SearchProducts; | ||
use PrestaShopBundle\ApiPlatform\Provider\QueryProvider; | ||
|
||
#[ApiResource( | ||
operations: [ | ||
new GetCollection( | ||
uriTemplate: '/products/search/{phrase}/{resultsLimit}/{isoCode}', | ||
openapiContext: [ | ||
'parameters' => [ | ||
[ | ||
'name' => 'phrase', | ||
'in' => 'path', | ||
'required' => true, | ||
'schema' => [ | ||
'type' => 'string', | ||
], | ||
], | ||
[ | ||
'name' => 'resultsLimit', | ||
'in' => 'path', | ||
'required' => true, | ||
'schema' => [ | ||
'type' => 'int', | ||
], | ||
], | ||
[ | ||
'name' => 'isoCode', | ||
'in' => 'path', | ||
'required' => true, | ||
'schema' => [ | ||
'type' => 'string', | ||
], | ||
], | ||
[ | ||
'name' => 'orderId', | ||
'in' => 'query', | ||
'required' => false, | ||
'schema' => [ | ||
'type' => 'int', | ||
], | ||
], | ||
], | ||
], | ||
provider: QueryProvider::class, | ||
extraProperties: [ | ||
'CQRSQuery' => SearchProducts::class, | ||
] | ||
), | ||
], | ||
)] | ||
class FoundProduct | ||
{ | ||
#[ApiProperty(identifier: true)] | ||
public int $productId; | ||
|
||
public bool $availableOutOfStock; | ||
|
||
public string $name; | ||
|
||
public float $taxRate; | ||
|
||
public string $formattedPrice; | ||
|
||
public float $priceTaxIncl; | ||
|
||
public float $priceTaxExcl; | ||
|
||
public int $stock; | ||
|
||
public string $location; | ||
|
||
public array $combinations; | ||
|
||
public array $customizationFields; | ||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +0,0 @@ | ||
<?php | ||
/** | ||
* Copyright since 2007 PrestaShop SA and Contributors | ||
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Open Software License (OSL 3.0) | ||
* that is bundled with this package in the file LICENSE.md. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://opensource.org/licenses/OSL-3.0 | ||
* If you did not receive a copy of the license and are unable to | ||
* obtain it through the world-wide-web, please send an email | ||
* to license@prestashop.com so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer | ||
* versions in the future. If you wish to customize PrestaShop for your | ||
* needs please refer to https://devdocs.prestashop.com/ for more information. | ||
* | ||
* @author PrestaShop SA and Contributors <contact@prestashop.com> | ||
* @copyright Since 2007 PrestaShop SA and Contributors | ||
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PrestaShopBundle\ApiPlatform\Resources; | ||
|
||
use ApiPlatform\Metadata\ApiProperty; | ||
use ApiPlatform\Metadata\ApiResource; | ||
use ApiPlatform\Metadata\Get; | ||
use ApiPlatform\Metadata\Put; | ||
use PrestaShop\PrestaShop\Core\Domain\Hook\Command\UpdateHookStatusCommand; | ||
use PrestaShop\PrestaShop\Core\Domain\Hook\Exception\HookNotFoundException; | ||
use PrestaShop\PrestaShop\Core\Domain\Hook\Query\GetHook; | ||
use PrestaShop\PrestaShop\Core\Domain\Hook\Query\GetHookStatus; | ||
use PrestaShopBundle\ApiPlatform\Processor\CommandProcessor; | ||
use PrestaShopBundle\ApiPlatform\Provider\QueryProvider; | ||
|
||
#[ApiResource( | ||
operations: [ | ||
new Get( | ||
uriTemplate: '/hook-status/{id}', | ||
requirements: ['id' => '\d+'], | ||
openapiContext: [ | ||
'summary' => 'Get hook status A', | ||
'description' => 'Get hook status B', | ||
'parameters' => [ | ||
[ | ||
'name' => 'id', | ||
'in' => 'path', | ||
'required' => true, | ||
'schema' => [ | ||
'type' => 'string', | ||
], | ||
'description' => 'Id of the hook you are requesting the status from', | ||
], | ||
[ | ||
'name' => 'Authorization', | ||
'in' => 'scopes', | ||
'description' => 'hook_read <br> hook_write ', | ||
], | ||
], | ||
], | ||
exceptionToStatus: [HookNotFoundException::class => 404], | ||
provider: QueryProvider::class, | ||
extraProperties: [ | ||
'CQRSQuery' => GetHookStatus::class, | ||
'scopes' => ['hook_read'], | ||
] | ||
), | ||
new Put( | ||
uriTemplate: '/hook-status', | ||
processor: CommandProcessor::class, | ||
extraProperties: [ | ||
'CQRSCommand' => UpdateHookStatusCommand::class, | ||
'scopes' => ['hook_write'], | ||
] | ||
), | ||
new Get( | ||
uriTemplate: '/hooks/{id}', | ||
requirements: ['id' => '\d+'], | ||
exceptionToStatus: [HookNotFoundException::class => 404], | ||
provider: QueryProvider::class, | ||
extraProperties: [ | ||
'CQRSQuery' => GetHook::class, | ||
'scopes' => ['hook_read'], | ||
] | ||
), | ||
], | ||
)] | ||
class Hook | ||
{ | ||
#[ApiProperty(identifier: true)] | ||
public int $id; | ||
|
||
public bool $active; | ||
|
||
public string $name; | ||
|
||
public string $title; | ||
|
||
public string $description; | ||
} | ||
Oops, something went wrong.