54 lines
1.7 KiB
PHP
54 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\GraphQLBundle\ApiAdmin\Controller;
|
|
|
|
use KupShop\GraphQLBundle\ApiAdmin\Annotation\Module;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Dropshipment\Dropshipment;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Dropshipment\DropshipmentCollection;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Dropshipment\Input\DropshipmentFilterInput;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Dropshipment\Input\DropshipmentInput;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Types\Dropshipment\Response\DropshipmentMutateResponse;
|
|
use KupShop\GraphQLBundle\ApiAdmin\Util\Dropshipment\DropshipmentUtil;
|
|
use TheCodingMachine\GraphQLite\Annotations\Mutation;
|
|
use TheCodingMachine\GraphQLite\Annotations\Query;
|
|
|
|
class DropshipmentController
|
|
{
|
|
public function __construct(
|
|
private DropshipmentUtil $dropshipmentUtil,
|
|
) {
|
|
}
|
|
|
|
/**
|
|
* Načte dropshipment podle ID.
|
|
*/
|
|
#[Query]
|
|
#[Module(\Modules::DROPSHIP)]
|
|
public function dropshipment(int $id): ?Dropshipment
|
|
{
|
|
return $this->dropshipmentUtil->getDropshipment($id);
|
|
}
|
|
|
|
/**
|
|
* Seznam dropshipmentů.
|
|
*/
|
|
#[Query]
|
|
#[Module(\Modules::DROPSHIP)]
|
|
public function dropshipments(int $offset = 0, int $limit = 100, ?DropshipmentFilterInput $filter = null): DropshipmentCollection
|
|
{
|
|
return $this->dropshipmentUtil->getDropshipments($offset, $limit, $filter);
|
|
}
|
|
|
|
/**
|
|
* Vytvoření/aktualizace dropshipmentu.
|
|
*/
|
|
#[Mutation]
|
|
#[Module(\Modules::DROPSHIP)]
|
|
public function dropshipmentCreateOrUpdate(DropshipmentInput $input): DropshipmentMutateResponse
|
|
{
|
|
return $this->dropshipmentUtil->createOrUpdateDropshipment($input);
|
|
}
|
|
}
|