|
16 | 16 | use App\Serializer\Normalizer\RelatedCollectionLink; |
17 | 17 | use App\State\CampCreateProcessor; |
18 | 18 | use App\State\CampRemoveProcessor; |
| 19 | +use App\State\CampUpdateProcessor; |
19 | 20 | use App\Util\EntityMap; |
20 | 21 | use App\Validator\AssertContainsAtLeastOneManager; |
21 | 22 | use Doctrine\Common\Collections\ArrayCollection; |
|
38 | 39 | normalizationContext: self::ITEM_NORMALIZATION_CONTEXT, |
39 | 40 | ), |
40 | 41 | new Patch( |
| 42 | + processor: CampUpdateProcessor::class, |
41 | 43 | security: 'is_granted("CAMP_MEMBER", object) or is_granted("CAMP_MANAGER", object)', |
42 | 44 | denormalizationContext: ['groups' => ['write', 'update']], |
43 | 45 | normalizationContext: self::ITEM_NORMALIZATION_CONTEXT, |
@@ -196,6 +198,24 @@ class Camp extends BaseEntity implements BelongsToCampInterface, CopyFromPrototy |
196 | 198 | #[ORM\Column(type: 'boolean', nullable: false, options: ['default' => false])] |
197 | 199 | public bool $isShared = false; |
198 | 200 |
|
| 201 | + /** |
| 202 | + * Date and time when the camp was last set to be shared publicly. |
| 203 | + */ |
| 204 | + #[ApiProperty(example: '2025-10-01T00:00:00+00:00', required: true, openapiContext: ['format' => 'date-time'])] |
| 205 | + #[Groups(['read'])] |
| 206 | + #[ORM\Column(type: 'datetime', nullable: true)] |
| 207 | + public ?\DateTimeInterface $sharedSince = null; |
| 208 | + |
| 209 | + /** |
| 210 | + * The person who last set the camp to be shared publicly. |
| 211 | + */ |
| 212 | + #[Assert\DisableAutoMapping] |
| 213 | + #[ApiProperty(writable: false)] |
| 214 | + #[Groups(['read'])] |
| 215 | + #[ORM\ManyToOne(targetEntity: User::class)] |
| 216 | + #[ORM\JoinColumn(nullable: true)] |
| 217 | + public ?User $sharedBy = null; |
| 218 | + |
199 | 219 | /** |
200 | 220 | * Whether this camp may serve as a template for creating other camps. |
201 | 221 | */ |
|
0 commit comments