39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\GraphQLBundle\ApiAdmin\Controller;
|
|
|
|
use KupShop\GraphQLBundle\ApiAdmin\Annotation\Module;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Charge;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Collection\ChargeCollection;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Parameters;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Util\ChargesUtil;
|
|
use TheCodingMachine\GraphQLite\Annotations\Query;
|
|
use TheCodingMachine\GraphQLite\Annotations\UseInputType;
|
|
|
|
class ChargeController
|
|
{
|
|
public function __construct(private readonly ChargesUtil $chargesUtil)
|
|
{
|
|
}
|
|
|
|
#[Query]
|
|
#[Module(\Modules::PRODUCTS_CHARGES)]
|
|
public function charge(int $id): ?Charge
|
|
{
|
|
return $this->chargesUtil->getCharge($id);
|
|
}
|
|
|
|
#[Query]
|
|
#[Module(\Modules::PRODUCTS_CHARGES)]
|
|
public function charges(
|
|
int $offset = 0,
|
|
int $limit = 100,
|
|
#[UseInputType('ChargeSortInput')] ?Parameters $sort = null,
|
|
#[UseInputType('ChargeFilterInput')] ?Parameters $filter = null,
|
|
): ChargeCollection {
|
|
return $this->chargesUtil->getChargeCollection($offset, $limit, $sort, $filter);
|
|
}
|
|
}
|