49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace dominion\settings\schema;
|
||
|
|
||
|
use GraphQL\Type\Definition\Type;
|
||
|
use dominion\api\GraphQLSchemaPagination;
|
||
|
use dominion\settings\Settings;
|
||
|
use dominion\api\GraphQLPagination;
|
||
|
|
||
|
|
||
|
class SettingsPaginationType extends GraphQLSchemaPagination
|
||
|
{
|
||
|
|
||
|
public function __construct()
|
||
|
{
|
||
|
$config = [
|
||
|
'fields' => function(){
|
||
|
$output = $this->getCustomFields();
|
||
|
$output['data'] = [
|
||
|
'type' => Type::listOf(Types::settings()),
|
||
|
'description' => 'Настройки',
|
||
|
'args' => GraphQLPagination::argumentModify([
|
||
|
'id' => [
|
||
|
'type' => Type::int(),
|
||
|
'description' => 'Id',
|
||
|
],
|
||
|
'code' => [
|
||
|
'type' => Type::string(),
|
||
|
'description' => 'символьный код',
|
||
|
'modify' => true,
|
||
|
'modifyOption' => ['in'],
|
||
|
],
|
||
|
'sort' => [
|
||
|
'type' => Type::string(),
|
||
|
'description' => 'Сортировка (пример "isNew_asc" или "isVisible_desc")',
|
||
|
],
|
||
|
]),
|
||
|
'resolve' => function($root, $args){
|
||
|
return Settings::getData($args, $root);
|
||
|
}
|
||
|
];
|
||
|
return $output;
|
||
|
}
|
||
|
];
|
||
|
parent::__construct($config);
|
||
|
}
|
||
|
|
||
|
}
|