diff --git a/src/ApiResource/Project/RewardClaimApiResource.php b/src/ApiResource/Project/RewardClaimApiResource.php index 6ddfd97..704f5be 100644 --- a/src/ApiResource/Project/RewardClaimApiResource.php +++ b/src/ApiResource/Project/RewardClaimApiResource.php @@ -6,11 +6,11 @@ use ApiPlatform\Doctrine\Orm\State\Options; use ApiPlatform\Metadata as API; use App\ApiResource\Gateway\ChargeApiResource; use App\ApiResource\User\UserApiResource; +use App\Dto\RewardClaimCreationDto; use App\Entity\Project\RewardClaim; use App\State\ApiResourceStateProvider; use App\State\Project\RewardClaimStateProcessor; use App\Validator\AvailableRewardUnits; -use App\Validator\EnoughRewardCharge; use Symfony\Component\Validator\Constraints as Assert; /** @@ -22,7 +22,10 @@ use Symfony\Component\Validator\Constraints as Assert; provider: ApiResourceStateProvider::class, processor: RewardClaimStateProcessor::class )] -#[EnoughRewardCharge()] +#[API\GetCollection()] +#[API\Post(input: RewardClaimCreationDto::class)] +#[API\Get()] +#[API\Delete()] class RewardClaimApiResource { #[API\ApiProperty(identifier: true, writable: false)] diff --git a/src/Dto/RewardClaimCreationDto.php b/src/Dto/RewardClaimCreationDto.php new file mode 100644 index 0000000..b6f5251 --- /dev/null +++ b/src/Dto/RewardClaimCreationDto.php @@ -0,0 +1,30 @@ +autoMapper->map($data, RewardClaim::class); - if (!$claim->getId()) { + if ($data instanceof RewardClaimCreationDto) { $owner = $this->authService->getUser(); if (!$owner) {