| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- declare(strict_types=1);
- namespace App\ApiResources\Mobyt;
- use ApiPlatform\Core\Annotation\ApiProperty;
- use ApiPlatform\Core\Annotation\ApiResource;
- use Symfony\Component\Serializer\Annotation\Groups;
- /**
- * Statut de l'utilisateur Mobyt correspondant à l'organization donnée en paramètre
- */
- #[ApiResource(
- itemOperations: [
- 'get' => [
- 'security' => 'is_granted("ROLE_TEXTO") and object.getOrganizationId() == user.getOrganization().getId()',
- 'method' => 'GET',
- 'path' => '/mobyt/status/{organizationId}',
- 'requirements' => ['organizationId' => '\d+'],
- 'normalization_context' => [
- 'groups' => ['mobyt_get']
- ],
- ],
- ]
- )]
- class MobytUserStatus
- {
- #[ApiProperty(identifier: true)]
- #[Groups('mobyt_get')]
- private int $organizationId;
- /**
- * Is there a Mobyt account active for this user
- */
- #[Groups('mobyt_get')]
- private bool $active = false;
- /**
- * Amount of sms remaining
- */
- #[Groups('mobyt_get')]
- private int $amount = 0;
- /**
- * Money remaining
- */
- #[Groups('mobyt_get')]
- private float $money = 0;
- public function getOrganizationId(): int
- {
- return $this->organizationId;
- }
- public function setOrganizationId(int $organizationId): void
- {
- $this->organizationId = $organizationId;
- }
- public function isActive(): bool
- {
- return $this->active;
- }
- public function setActive(bool $active): void
- {
- $this->active = $active;
- }
- public function getAmount(): int
- {
- return $this->amount;
- }
- public function setAmount(int $amount): void
- {
- $this->amount = $amount;
- }
- public function getMoney(): float
- {
- return $this->money;
- }
- public function setMoney(float $money): void
- {
- $this->money = $money;
- }
- }
|