oncall-engine/engine/apps/mobile_app/urls.py
Vadim Stepanov 147503eea8
Return 404 from mobile app gateway viewset (#3518)
# What this PR does

Changes how the `MOBILE_APP_GATEWAY_ENABLED` feature flag
enables/disables the mobile app gateway viewset.

## Checklist

- [x] Unit, integration, and e2e (if applicable) tests updated
- [x] Documentation added (or `pr:no public docs` PR label added if not
required)
- [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not
required)
2023-12-06 10:57:07 +00:00

42 lines
1.3 KiB
Python

from django.urls import re_path
from apps.mobile_app.fcm_relay import FCMRelayView
from apps.mobile_app.views import (
FCMDeviceAuthorizedViewSet,
MobileAppAuthTokenAPIView,
MobileAppGatewayView,
MobileAppUserSettingsViewSet,
)
from common.api_helpers.optional_slash_router import OptionalSlashRouter, optional_slash_path
app_name = "mobile_app"
router = OptionalSlashRouter()
router.register("fcm", FCMDeviceAuthorizedViewSet, basename="fcm")
urlpatterns = [
*router.urls,
optional_slash_path("auth_token", MobileAppAuthTokenAPIView.as_view(), name="auth_token"),
optional_slash_path(
"user_settings/notification_timing_options",
MobileAppUserSettingsViewSet.as_view({"get": "notification_timing_options"}),
name="notification_timing_options",
),
optional_slash_path(
"user_settings",
MobileAppUserSettingsViewSet.as_view({"get": "retrieve", "put": "update", "patch": "partial_update"}),
name="user_settings",
),
]
urlpatterns += [
optional_slash_path("fcm_relay", FCMRelayView.as_view(), name="fcm_relay"),
]
urlpatterns += [
re_path(
r"^gateway/(?P<downstream_backend>\w*)/(?P<downstream_path>.*)$",
MobileAppGatewayView.as_view(),
name="gateway",
),
]