Phase 1 : endpoints API complets

- CoastalPoint → shortName Spot → /api/spots (API Platform)
- SargassumForecast → shortName Forecast → /api/forecasts
- ObservationController : GET /api/observations avec filtres
  bbox (PostGIS ST_Intersects), date, source + geometry ST_AsGeoJSON
- SpotScoreController : GET /api/spots/{id}/score avec ?at= optionnel
- FeedbackController : POST /api/feedback, anonyme, fingerprint SHA256
- CORS : autorisation radarsargasses971.com + localhost dev

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Gwadaking
2026-04-01 02:50:06 -04:00
parent bf64340525
commit 4af5e62465
7 changed files with 289 additions and 13 deletions

View File

@@ -6,6 +6,7 @@ use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use App\Repository\CoastalPointRepository;
use Symfony\Component\Serializer\Annotation\Groups;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
@@ -16,10 +17,13 @@ use Symfony\Component\Uid\Uuid;
#[ORM\Index(columns: ['type'], name: 'idx_coastal_type')]
#[ORM\Index(columns: ['region'], name: 'idx_coastal_region')]
#[ApiResource(
shortName: 'Spot',
operations: [
new GetCollection(),
new Get(),
]
],
normalizationContext: ['groups' => ['spot:read']],
order: ['name' => 'ASC'],
)]
class CoastalPoint
{
@@ -30,15 +34,19 @@ class CoastalPoint
private ?Uuid $id = null;
#[ORM\Column(length: 150)]
#[Groups(['spot:read'])]
private ?string $name = null;
#[ORM\Column(type: 'geometry', options: ['geometry_type' => 'POINT', 'srid' => 4326])]
#[Groups(['spot:read'])]
private mixed $geometry = null;
#[ORM\Column(length: 30)]
#[Groups(['spot:read'])]
private ?string $type = null;
#[ORM\Column(length: 100)]
#[Groups(['spot:read'])]
private ?string $region = null;
#[ORM\OneToMany(targetEntity: ImpactScore::class, mappedBy: 'coastalPoint')]