add api endpoint for listing calendars

This commit is contained in:
2022-07-02 14:31:27 +02:00
parent 26a0ba4756
commit 3df06e1eba
4 changed files with 211 additions and 8 deletions

View File

@@ -85,7 +85,6 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars")
* @Serializer\Groups({"read"})
*/
private AccompanyingPeriod $accompanyingPeriod;
@@ -113,7 +112,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
* @Serializer\Groups({"calendar:read", "read"})
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
* @Assert\NotNull(message="calendar.An end date is required")
*/
private ?DateTimeImmutable $endDate = null;
@@ -122,7 +121,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Groups({"calendar:read", "read"})
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
*/
private ?int $id = null;
@@ -147,7 +146,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
* @Serializer\Groups({"calendar:read", "read"})
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
* @Assert\NotNull(message="calendar.A main user is mandatory")
*/
private ?User $mainUser = null;
@@ -155,7 +155,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person", inversedBy="calendars")
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
* @Serializer\Groups({"calendar:read", "read"})
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
* @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.")
*/
private Collection $persons;
@@ -169,7 +170,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
* @Serializer\Groups({"calendar:read", "read"})
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/
private Collection $professionals;
@@ -185,13 +187,16 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
* @Serializer\Groups({"calendar:read", "read"})
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
* @Assert\NotNull(message="calendar.A start date is required")
*/
private ?DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="string", length=255, nullable=false, options={"default": "valid"})
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/
private string $status = self::STATUS_VALID;