| @@ -1633,6 +1633,18 @@ paths: | |||||
| style: form | style: form | ||||
| explode: true | explode: true | ||||
| allowReserved: false | allowReserved: false | ||||
| - | |||||
| name: product.name | |||||
| in: query | |||||
| description: '' | |||||
| required: false | |||||
| deprecated: false | |||||
| allowEmptyValue: true | |||||
| schema: | |||||
| type: string | |||||
| style: form | |||||
| explode: false | |||||
| allowReserved: false | |||||
| deprecated: false | deprecated: false | ||||
| post: | post: | ||||
| operationId: api_partner_products_post | operationId: api_partner_products_post | ||||
| @@ -2185,6 +2197,32 @@ paths: | |||||
| style: form | style: form | ||||
| explode: true | explode: true | ||||
| allowReserved: false | allowReserved: false | ||||
| - | |||||
| name: owner | |||||
| in: query | |||||
| description: '' | |||||
| required: false | |||||
| deprecated: false | |||||
| allowEmptyValue: true | |||||
| schema: | |||||
| type: string | |||||
| style: form | |||||
| explode: false | |||||
| allowReserved: false | |||||
| - | |||||
| name: 'owner[]' | |||||
| in: query | |||||
| description: '' | |||||
| required: false | |||||
| deprecated: false | |||||
| allowEmptyValue: true | |||||
| schema: | |||||
| type: array | |||||
| items: | |||||
| type: string | |||||
| style: form | |||||
| explode: true | |||||
| allowReserved: false | |||||
| - | - | ||||
| name: 'exists[contact]' | name: 'exists[contact]' | ||||
| in: query | in: query | ||||
| @@ -6816,6 +6854,11 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| imageUrl: | |||||
| readOnly: true | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| password: | password: | ||||
| writeOnly: true | writeOnly: true | ||||
| description: 'The plaintext password when being set or changed.' | description: 'The plaintext password when being set or changed.' | ||||
| @@ -6869,6 +6912,11 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| imageUrl: | |||||
| readOnly: true | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| password: | password: | ||||
| writeOnly: true | writeOnly: true | ||||
| description: 'The plaintext password when being set or changed.' | description: 'The plaintext password when being set or changed.' | ||||
| @@ -6936,6 +6984,11 @@ components: | |||||
| - 'null' | - 'null' | ||||
| format: iri-reference | format: iri-reference | ||||
| example: 'https://example.com/' | example: 'https://example.com/' | ||||
| imageUrl: | |||||
| readOnly: true | |||||
| type: | |||||
| - string | |||||
| - 'null' | |||||
| password: | password: | ||||
| writeOnly: true | writeOnly: true | ||||
| description: 'The plaintext password when being set or changed.' | description: 'The plaintext password when being set or changed.' | ||||
| @@ -42,7 +42,7 @@ use Symfony\Component\Validator\Constraints\NotBlank; | |||||
| processor: EntityClassDtoStateProcessor::class, | processor: EntityClassDtoStateProcessor::class, | ||||
| stateOptions: new Options(entityClass: PartnerProduct::class), | stateOptions: new Options(entityClass: PartnerProduct::class), | ||||
| )] | )] | ||||
| #[ApiFilter(SearchFilter::class, properties: ['partner' => 'exact', 'product' => 'exact'])] | |||||
| #[ApiFilter(SearchFilter::class, properties: ['partner' => 'exact', 'product' => 'exact', 'product.name' => 'ipartial'])] | |||||
| class PartnerProductApi | class PartnerProductApi | ||||
| { | { | ||||
| #[ApiProperty(readable: false, writable: false, identifier: true)] | #[ApiProperty(readable: false, writable: false, identifier: true)] | ||||
| @@ -57,7 +57,8 @@ use Symfony\Component\Validator\Constraints\NotBlank; | |||||
| #[ApiFilter(SearchFilter::class, properties: [ | #[ApiFilter(SearchFilter::class, properties: [ | ||||
| 'partner' => 'exact', | 'partner' => 'exact', | ||||
| 'contact' => 'exact', | 'contact' => 'exact', | ||||
| 'sale' => 'exact' | |||||
| 'sale' => 'exact', | |||||
| 'owner' => 'exact' | |||||
| ])] | ])] | ||||
| #[ApiFilter(ExistsFilter::class, properties: [ | #[ApiFilter(ExistsFilter::class, properties: [ | ||||
| 'contact', | 'contact', | ||||
| @@ -64,6 +64,9 @@ class UserApi | |||||
| public ?MediaObject $image = null; | public ?MediaObject $image = null; | ||||
| #[ApiProperty(writable: false)] | |||||
| public ?string $imageUrl = null; | |||||
| /** | /** | ||||
| * The plaintext password when being set or changed. | * The plaintext password when being set or changed. | ||||
| */ | */ | ||||
| @@ -46,6 +46,7 @@ class AuthenticationSuccessListener | |||||
| $data['firstName'] = $user->getFirstName(); | $data['firstName'] = $user->getFirstName(); | ||||
| $data['lastName'] = $user->getLastName(); | $data['lastName'] = $user->getLastName(); | ||||
| $data['roles'] = $user->getRoles(); | $data['roles'] = $user->getRoles(); | ||||
| $data['userResource'] = $userApi; | |||||
| $event->setData($data); | $event->setData($data); | ||||
| } | } | ||||
| } | } | ||||
| @@ -6,6 +6,7 @@ use App\ApiResource\CommentApi; | |||||
| use App\ApiResource\ContactApi; | use App\ApiResource\ContactApi; | ||||
| use App\ApiResource\PartnerApi; | use App\ApiResource\PartnerApi; | ||||
| use App\ApiResource\ProductApi; | use App\ApiResource\ProductApi; | ||||
| use App\ApiResource\SaleApi; | |||||
| use App\ApiResource\UserApi; | use App\ApiResource\UserApi; | ||||
| use App\ApiResource\PostingApi; | use App\ApiResource\PostingApi; | ||||
| use App\Entity\Comment; | use App\Entity\Comment; | ||||
| @@ -65,6 +66,13 @@ class PostingEntityToApiMapper implements MapperInterface | |||||
| ]); | ]); | ||||
| } | } | ||||
| $dto->sale = null; | |||||
| if ($entity->getSale() !== null) { | |||||
| $dto->sale = $this->microMapper->map($entity->getSale(), SaleApi::class, [ | |||||
| MicroMapperInterface::MAX_DEPTH => 1, | |||||
| ]); | |||||
| } | |||||
| $dto->comments = array_map(function(Comment $comment) { | $dto->comments = array_map(function(Comment $comment) { | ||||
| return $this->microMapper->map($comment, CommentApi::class, [ | return $this->microMapper->map($comment, CommentApi::class, [ | ||||
| MicroMapperInterface::MAX_DEPTH => 1, | MicroMapperInterface::MAX_DEPTH => 1, | ||||
| @@ -6,6 +6,7 @@ use App\ApiResource\UserApi; | |||||
| use App\ApiResource\PostingApi; | use App\ApiResource\PostingApi; | ||||
| use App\Entity\User; | use App\Entity\User; | ||||
| use App\Entity\Posting; | use App\Entity\Posting; | ||||
| use App\Service\FileUrlService; | |||||
| use Symfonycasts\MicroMapper\AsMapper; | use Symfonycasts\MicroMapper\AsMapper; | ||||
| use Symfonycasts\MicroMapper\MapperInterface; | use Symfonycasts\MicroMapper\MapperInterface; | ||||
| use Symfonycasts\MicroMapper\MicroMapperInterface; | use Symfonycasts\MicroMapper\MicroMapperInterface; | ||||
| @@ -15,6 +16,7 @@ class UserEntityToApiMapper implements MapperInterface | |||||
| { | { | ||||
| public function __construct( | public function __construct( | ||||
| private MicroMapperInterface $microMapper, | private MicroMapperInterface $microMapper, | ||||
| private FileUrlService $fileUrlService | |||||
| ) | ) | ||||
| { | { | ||||
| } | } | ||||
| @@ -41,6 +43,7 @@ class UserEntityToApiMapper implements MapperInterface | |||||
| $dto->firstName = $entity->getFirstName(); | $dto->firstName = $entity->getFirstName(); | ||||
| $dto->lastName = $entity->getLastName(); | $dto->lastName = $entity->getLastName(); | ||||
| $dto->image = $entity->getImage(); | $dto->image = $entity->getImage(); | ||||
| $dto->imageUrl = $this->fileUrlService->getFileUrl($entity->getImage()); | |||||
| return $dto; | return $dto; | ||||
| } | } | ||||