Skip to content

Commit 22cd016

Browse files
committed
Attachment endpoints
1 parent 7f88a4b commit 22cd016

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<?php
2+
/**
3+
* Copyright since 2007 PrestaShop SA and Contributors
4+
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
5+
*
6+
* NOTICE OF LICENSE
7+
*
8+
* This source file is subject to the Academic Free License version 3.0
9+
* that is bundled with this package in the file LICENSE.md.
10+
* It is also available through the world-wide-web at this URL:
11+
* https://opensource.org/licenses/AFL-3.0
12+
* If you did not receive a copy of the license and are unable to
13+
* obtain it through the world-wide-web, please send an email
14+
* to license@prestashop.com so we can send you a copy immediately.
15+
*
16+
* @author PrestaShop SA and Contributors <contact@prestashop.com>
17+
* @copyright Since 2007 PrestaShop SA and Contributors
18+
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
19+
*/
20+
21+
namespace PrestaShop\Module\APIResources\ApiPlatform\Resources\Attachment;
22+
23+
use ApiPlatform\Metadata\ApiProperty;
24+
use ApiPlatform\Metadata\ApiResource;
25+
use PrestaShop\PrestaShop\Core\Search\Filters\AttachmentFilters;
26+
use PrestaShopBundle\ApiPlatform\Metadata\PaginatedList;
27+
28+
#[ApiResource(
29+
operations: [
30+
new PaginatedList(
31+
uriTemplate: '/attachments',
32+
scopes: [
33+
'attachment_read',
34+
],
35+
ApiResourceMapping: self::MAPPING,
36+
gridDataFactory: 'prestashop.core.grid.data_factory.attachment_decorator',
37+
filtersClass: AttachmentFilters::class,
38+
filtersMapping: [
39+
'[attachmentId]' => '[id_attachment]',
40+
],
41+
),
42+
]
43+
)]
44+
class AttachmentList
45+
{
46+
#[ApiProperty(identifier: true)]
47+
public int $attachmentId;
48+
49+
public string $name;
50+
51+
public string $file;
52+
53+
public string $file_size;
54+
55+
public string $products;
56+
57+
public const MAPPING = [
58+
'[id_attachment]' => '[attachmentId]',
59+
];
60+
}

0 commit comments

Comments
 (0)