Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve routing #342

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 72 additions & 3 deletions config/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,76 @@
app_directory:
resource: './routing/'
type: directory
app.swagger_ui:
path: /api/doc
methods: [GET]
defaults:
_controller: nelmio_api_doc.controller.swagger_ui

controllers:
resource: ../src/Controller/
type: attribute

presta_sitemap:
resource: "@PrestaSitemapBundle/config/routing.yml"

fos_js_routing:
resource: '@FOSJsRoutingBundle/Resources/config/routing/routing-sf4.xml'

privacy:
path: /privacy
defaults:
_controller: App\Controller\TemplateController::staticAction
templateName: privacy

impress:
path: /impress
defaults:
_controller: App\Controller\TemplateController::staticAction
templateName: impress

limits:
path: /grenzwerte
defaults:
_controller: App\Controller\TemplateController::staticAction
templateName: limits

pollutant_pm10:
path: /schadstoffe/feinstaub
defaults:
_controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction
template: Static/Pollutant/feinstaub.html.twig

pollutant_no2:
path: /schadstoffe/stickstoffdioxid
defaults:
_controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction
template: Static/Pollutant/stickstoffdioxid.html.twig

pollutant_so2:
path: /schadstoffe/schwefeldioxid
defaults:
_controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction
template: Static/Pollutant/schwefeldioxid.html.twig

pollutant_co:
path: /schadstoffe/kohlenmonoxid
defaults:
_controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction
template: Static/Pollutant/kohlenmonoxid.html.twig

pollutant_o3:
path: /schadstoffe/ozon
defaults:
_controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController::templateAction
template: Static/Pollutant/ozon.html.twig

when@dev:
web_profiler_wdt:
resource: '@WebProfilerBundle/Resources/config/routing/wdt.xml'
prefix: /_wdt

web_profiler_profiler:
resource: '@WebProfilerBundle/Resources/config/routing/profiler.xml'
prefix: /_profiler

_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error
8 changes: 0 additions & 8 deletions config/routes/web_profiler.yaml

This file was deleted.

46 changes: 0 additions & 46 deletions config/routing/1_static.xml

This file was deleted.

54 changes: 0 additions & 54 deletions config/routing/2_api.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,58 +7,4 @@
<route id="app.swagger_ui" path="/api/doc" methods="GET">
<default key="_controller">nelmio_api_doc.controller.swagger_ui</default>
</route>

<route id="api_station_station" path="/api/station/{stationCode}" methods="GET">
<default key="_controller">App\Controller\Api\StationApiController::stationAction</default>
<requirement key="stationCode">^([A-Z]{4,6})([0-9]{0,8})$</requirement>
</route>

<route id="api_station_post" path="/api/station/{stationCode}" methods="POST">
<default key="_controller">App\Controller\Api\StationApiController::postStationAction</default>
<requirement key="stationCode">^([A-Z]{4,6})([0-9]{0,8})$</requirement>
</route>

<route id="api_station_all" path="/api/station" methods="GET">
<default key="_controller">App\Controller\Api\StationApiController::listStationAction</default>
</route>

<route id="api_station_put" path="/api/station" methods="PUT">
<default key="_controller">App\Controller\Api\StationApiController::putStationAction</default>
</route>

<route id="api_city_all" path="/api/city" methods="GET">
<default key="_controller">App\Controller\Api\CityApiController::cityAction</default>
</route>

<route id="api_city_put" path="/api/city" methods="PUT">
<default key="_controller">App\Controller\Api\CityApiController::putCityAction</default>
</route>

<route id="api_city" path="/api/{citySlug}" methods="GET">
<default key="_controller">App\Controller\Api\CityApiController::displayCityAction</default>
<requirement key="citySlug">^([A-Za-z-]+)$</requirement>
</route>

<route id="api_city_post" path="/api/{citySlug}" methods="POST">
<default key="_controller">App\Controller\Api\CityApiController::postCityAction</default>
<requirement key="citySlug">^([A-Za-z-]+)$</requirement>
</route>

<route id="api_station" path="/api/{stationCode}" methods="GET">
<default key="_controller">App\Controller\Api\DisplayApiController::displayStationAction</default>
<requirement key="stationCode">^([A-Z]{2,6})([A-Z0-9]{0,8})$</requirement>
</route>

<route id="api_station_analysis" path="/api/{stationCode}/analysis" methods="GET">
<default key="_controller">App\Controller\Api\AnalysisApiController::stationAnalysisAction</default>
<requirement key="stationCode">^([A-Z]{4,6})([0-9]{1,5})$</requirement>
</route>

<route id="api_display" path="/api" methods="GET">
<default key="_controller">App\Controller\Api\DisplayApiController::displayAction</default>
</route>

<route id="api_value_put" path="/api/value" methods="PUT">
<default key="_controller">App\Controller\Api\ValueApiController::putValueAction</default>
</route>
</routes>
21 changes: 0 additions & 21 deletions config/routing/3_typeahead.xml

This file was deleted.

36 changes: 0 additions & 36 deletions config/routing/4_frontend.xml

This file was deleted.

22 changes: 0 additions & 22 deletions config/routing/5_analysis.xml

This file was deleted.

12 changes: 0 additions & 12 deletions config/routing/6_city.xml

This file was deleted.

7 changes: 0 additions & 7 deletions config/routing/dev/web_profiler.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/routing/fos_js_routing.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions config/routing/framework.yaml

This file was deleted.

2 changes: 0 additions & 2 deletions config/routing/presta_sitemap.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions src/Controller/AnalysisController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Flagception\Bundle\FlagceptionBundle\Annotations\Feature;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

/**
* @Feature("analysis")
Expand All @@ -21,6 +22,7 @@ class AnalysisController extends AbstractController
/**
* @Feature("analysis_komfortofen")
*/
#[Route(path: '/analysis/komfortofen', name: 'analysis_komfortofen', priority: 501)]
public function komfortofenAction(KomfortofenAnalysisInterface $komfortofenAnalysis, SeoPageInterface $seoPage): Response
{
$interval = new \DateInterval('P30D');
Expand All @@ -43,6 +45,7 @@ public function komfortofenAction(KomfortofenAnalysisInterface $komfortofenAnaly
/**
* @Feature("analysis_fireworks")
*/
#[Route(path: '/analysis/silvester', name: 'analysis_fireworks', priority: 502)]
public function fireworksAction(FireworksAnalysisInterface $fireworksAnalysis, SeoPageInterface $seoPage): Response
{
$seoPage
Expand All @@ -61,6 +64,7 @@ public function fireworksAction(FireworksAnalysisInterface $fireworksAnalysis, S
/**
* @Feature("analysis_fireworks")
*/
#[Route(path: '/analysis/corona-silvester', name: 'analysis_fireworks_corona', priority: 503)]
public function coronaFireworksAction(Request $request, RequestConverterInterface $requestConverter, CoronaFireworksAnalysisInterface $coronaFireworksAnalysis, SeoPageInterface $seoPage): Response
{
$seoPage
Expand Down
2 changes: 2 additions & 0 deletions src/Controller/Api/AnalysisApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
use JMS\Serializer\SerializerInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;

class AnalysisApiController extends AbstractApiController
{
#[Route(path: '/api/{stationCode}/analysis', name: 'api_station_analysis', requirements: ['stationCode' => '^([A-Z]{4,6})([0-9]{1,5})$'], methods: ['GET'], priority: 211)]
public function stationAnalysisAction(
SerializerInterface $serializer,
string $stationCode,
Expand Down
Loading