ApiBundle] Add customer modification feature to APIP2

This commit is contained in:
Wojdylak 2023-10-24 08:50:05 +02:00
parent b962bfb6fc
commit df266cc161
5 changed files with 64 additions and 1 deletions

View file

@ -115,6 +115,13 @@
</itemOperation>
</itemOperations>
<subresourceOperations>
<subresourceOperation name="orders_get_subresource">
<attribute name="method">GET</attribute>
<attribute name="path">/admin/customers/{id}/orders</attribute>
</subresourceOperation>
</subresourceOperations>
<property name="id" identifier="true" writable="false" />
<property name="email" writable="true" />
<property name="firstName" writable="true" />
@ -122,6 +129,9 @@
<property name="fullName" writable="false" />
<property name="defaultAddress" writable="true" />
<property name="subscribedToNewsletter" writable="true" />
<property name="user" readable="true" iri="true" />
<property name="user" readable="true" writable="true" />
<property name="orders" readable="true" writable="false">
<subresource resourceClass="%sylius.model.order.class%" collection="true" />
</property>
</resource>
</resources>

View file

@ -391,6 +391,12 @@
<attribute name="method">GET</attribute>
<attribute name="path">/shop/orders/{tokenValue}/items/{items}/adjustments</attribute>
</subresourceOperation>
<subresourceOperation name="api_customers_orders_get_subresource">
<attribute name="normalization_context">
<attribute name="groups">admin:customer:read</attribute>
</attribute>
</subresourceOperation>
</subresourceOperations>
<property name="id" identifier="false" writable="false" />

View file

@ -0,0 +1,35 @@
<?xml version="1.0" ?>
<!--
This file is part of the Sylius package.
(c) Sylius Sp. z o.o.
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.shop_user.class%" shortName="ShopUser">
<attribute name="route_prefix">admin</attribute>
<itemOperations>
<itemOperation name="admin_get">
<attribute name="method">GET</attribute>
<attribute name="enabled">false</attribute>
<attribute name="controller">ApiPlatform\Core\Action\NotFoundAction</attribute>
<attribute name="read">false</attribute>
<attribute name="output">false</attribute>
</itemOperation>
</itemOperations>
<collectionOperations/>
<property name="id" identifier="true" writable="false" />
</resource>
</resources>

View file

@ -95,5 +95,9 @@
<group>shop:customer:read</group>
<group>shop:customer:update</group>
</attribute>
<attribute name="createdAt">
<group>admin:customer:read</group>
</attribute>
</class>
</serializer>

View file

@ -18,6 +18,7 @@
<class name="Sylius\Component\Core\Model\Order">
<attribute name="id">
<group>admin:order:read</group>
<group>admin:customer:read</group>
<group>shop:cart:read</group>
<group>shop:order:account:read</group>
<group>shop:order:read</group>
@ -25,6 +26,7 @@
<attribute name="number">
<group>admin:order:read</group>
<group>admin:customer:read</group>
<group>shop:cart:read</group>
<group>shop:order:account:read</group>
<group>shop:order:read</group>
@ -32,11 +34,13 @@
<attribute name="currencyCode">
<group>admin:order:read</group>
<group>admin:customer:read</group>
<group>shop:cart:read</group>
</attribute>
<attribute name="channel">
<group>admin:order:read</group>
<group>admin:customer:read</group>
<group>shop:order:read</group>
</attribute>
@ -64,21 +68,25 @@
<attribute name="state">
<group>admin:order:read</group>
<group>admin:customer:read</group>
<group>shop:order:read</group>
</attribute>
<attribute name="paymentState">
<group>admin:order:read</group>
<group>admin:customer:read</group>
<group>shop:cart:read</group>
</attribute>
<attribute name="shippingState">
<group>admin:order:read</group>
<group>admin:customer:read</group>
<group>shop:cart:read</group>
</attribute>
<attribute name="total">
<group>admin:order:read</group>
<group>admin:customer:read</group>
<group>shop:cart:read</group>
<group>shop:order:account:read</group>
</attribute>