Skip to content

Commit

Permalink
[PriceHistory][API][Admin] Add ChannelPricingLogEnties endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafikooo committed Mar 17, 2023
1 parent 23d616c commit 87f4dc8
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" ?>

<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->

<resources xmlns="https://api-platform.com/schema/metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
>
<resource class="%sylius.model.channel_pricing_log_entry.class%" shortName="ChannelPricingLogEntry">
<collectionOperations>
<collectionOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/channel-pricing-log-entries</attribute>
<attribute name="normalization_context">
<attribute name="groups">admin:channel_pricing_log_entry:read</attribute>
</attribute>
<attribute name="filters">
<attribute>sylius.api.channel_pricing_channel_filter</attribute>
<attribute>sylius.api.channel_pricing_product_variant_filter</attribute>
</attribute>
<attribute name="order">
<attribute name="id">DESC</attribute>
</attribute>
</collectionOperation>
</collectionOperations>

<itemOperations>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/channel-pricing-log-entries/{id}</attribute>
<attribute name="normalization_context">
<attribute name="groups">admin:channel_pricing_log_entry:read</attribute>
</attribute>
</itemOperation>
</itemOperations>

<property name="id" identifier="true" writable="false" />
<property name="channelPricing" readable="true" writable="false" />
<property name="price" readable="true" writable="false" />
<property name="originalPrice" readable="true" writable="false" />
<property name="loggedAt" readable="true" writable="false" />
</resource>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" ?>

<!--
This file is part of the Sylius package.
(c) Paweł Jędrzejewski
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
-->

<serializer xmlns="http://symfony.com/schema/dic/serializer-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd"
>
<class name="Sylius\Component\Core\Model\ChannelPricingLogEntry">
<attribute name="channelPricing">
<group>admin:channel_pricing_log_entry:read</group>
</attribute>
<attribute name="price">
<group>admin:channel_pricing_log_entry:read</group>
</attribute>
<attribute name="originalPrice">
<group>admin:channel_pricing_log_entry:read</group>
</attribute>
<attribute name="loggedAt">
<group>admin:channel_pricing_log_entry:read</group>
</attribute>
</class>
</serializer>
14 changes: 14 additions & 0 deletions src/Sylius/Bundle/ApiBundle/Resources/config/services/filters.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,19 @@
</argument>
<tag name="api_platform.filter" />
</service>

<service id="sylius.api.channel_pricing_channel_filter" parent="api_platform.doctrine.orm.search_filter" public="true">
<argument type="collection">
<argument key="channelPricing.channelCode">exact</argument>
</argument>
<tag name="api_platform.filter" />
</service>

<service id="sylius.api.channel_pricing_product_variant_filter" parent="api_platform.doctrine.orm.search_filter" public="true">
<argument type="collection">
<argument key="channelPricing.productVariant.code">exact</argument>
</argument>
<tag name="api_platform.filter" />
</service>
</services>
</container>

0 comments on commit 87f4dc8

Please sign in to comment.