Skip to content

Commit eef896c

Browse files
committed
fix(api): category delete endpoint mode
1 parent 9cc1e0c commit eef896c

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

src/ApiPlatform/Resources/Category/Category.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,28 @@
8686
new CQRSDelete(
8787
uriTemplate: '/category/{categoryId}',
8888
CQRSCommand: DeleteCategoryCommand::class,
89+
input: ['class' => DeleteCategoryCommand::class],
90+
openapiContext: [
91+
'requestBody' => [
92+
'required' => true,
93+
'content' => [
94+
'application/json' => [
95+
'schema' => [
96+
'type' => 'object',
97+
'properties' => [
98+
'mode' => [
99+
'type' => 'string',
100+
'enum' => ['associate_and_disable', 'associate_only', 'remove_associated'],
101+
'description' => 'Delete mode: associate_and_disable (associate products with parent and disable), associate_only (associate products with parent only), remove_associated (remove products only associated with this category)',
102+
'example' => 'associate_only',
103+
],
104+
],
105+
'required' => ['mode'],
106+
],
107+
],
108+
],
109+
],
110+
],
89111
scopes: [
90112
'category_write',
91113
],
@@ -193,6 +215,20 @@ class Category
193215

194216
public ?bool $isEnabled;
195217

218+
#[ApiProperty(
219+
openapiContext: [
220+
'type' => 'string',
221+
'enum' => [
222+
'associate_and_disable',
223+
'associate_only',
224+
'remove_associated',
225+
],
226+
'example' => 'associate_only',
227+
'description' => 'Delete mode: associate_and_disable (associate products with parent and disable), associate_only (associate products with parent only), remove_associated (remove products only associated with this category)',
228+
]
229+
)]
230+
public ?string $mode = null;
231+
196232
public const QUERY_MAPPING = [
197233
'[id]' => '[categoryId]',
198234
'[name]' => '[names]',

0 commit comments

Comments
 (0)