-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
frontend API: removed searching in products based on brand, category …
…or flag query - YAGNI violation
- Loading branch information
1 parent
cd86156
commit ce4ab1e
Showing
10 changed files
with
110 additions
and
56 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/Component/Arguments/AbstractPaginatorArgumentsBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopsys\FrontendApiBundle\Component\Arguments; | ||
|
||
use Overblog\GraphQLBundle\Definition\Builder\MappingInterface; | ||
|
||
class AbstractPaginatorArgumentsBuilder implements MappingInterface | ||
{ | ||
/** | ||
* @param array $config | ||
* @return array | ||
*/ | ||
public function toMappingDefinition(array $config): array | ||
{ | ||
return [ | ||
'after' => [ | ||
'type' => 'String', | ||
], | ||
'first' => [ | ||
'type' => 'Int', | ||
], | ||
'before' => [ | ||
'type' => 'String', | ||
], | ||
'last' => [ | ||
'type' => 'Int', | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
src/Component/Arguments/ProductPaginatorArgumentsBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopsys\FrontendApiBundle\Component\Arguments; | ||
|
||
class ProductPaginatorArgumentsBuilder extends AbstractProductPaginatorArgumentsBuilder | ||
{ | ||
/** | ||
* @param array $config | ||
* @return array | ||
*/ | ||
public function toMappingDefinition(array $config): array | ||
{ | ||
$this->checkMandatoryFields($config); | ||
|
||
$mappingDefinition = parent::toMappingDefinition($config); | ||
|
||
return array_merge($mappingDefinition, [ | ||
'categorySlug' => [ | ||
'type' => 'String', | ||
], | ||
'brandSlug' => [ | ||
'type' => 'String', | ||
], | ||
'flagSlug' => [ | ||
'type' => 'String', | ||
], | ||
]); | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/Component/Arguments/ProductSearchPaginatorArgumentsBuilder.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Shopsys\FrontendApiBundle\Component\Arguments; | ||
|
||
class ProductSearchPaginatorArgumentsBuilder extends AbstractProductPaginatorArgumentsBuilder | ||
{ | ||
/** | ||
* @param array $config | ||
* @return array | ||
*/ | ||
public function toMappingDefinition(array $config): array | ||
{ | ||
$this->checkMandatoryFields($config); | ||
|
||
$mappingDefinition = parent::toMappingDefinition($config); | ||
|
||
return array_merge($mappingDefinition, [ | ||
'search' => [ | ||
'type' => 'String', | ||
], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters