migrated to modern-rest
This commit is contained in:
parent
d9a92569f0
commit
8e44c4501a
11 changed files with 1014 additions and 572 deletions
|
|
@ -1,48 +1,59 @@
|
|||
from django.urls import path
|
||||
from rest_framework.routers import DefaultRouter
|
||||
from rest_framework.authtoken.views import obtain_auth_token
|
||||
from dmr.routing import Router, path
|
||||
from .views import (
|
||||
PredictionViewSet,
|
||||
SavedPointViewset,
|
||||
PreditctionTemplateViewset,
|
||||
TelemetryListCreateView,
|
||||
get_csrf,
|
||||
login_view,
|
||||
logout_view,
|
||||
SessionView,
|
||||
WhoAmIView,
|
||||
UserProfileView,
|
||||
ChangePasswordView,
|
||||
TokenManagementView,
|
||||
DeleteUserDataView,
|
||||
DeleteAccountView
|
||||
PredictionCollectionController,
|
||||
PredictionListUserController,
|
||||
PredictionHistoryController,
|
||||
PredictionDetailController,
|
||||
PredictionDeleteController,
|
||||
SavedPointListController,
|
||||
SavedPointDetailController,
|
||||
PredictionTemplateListController,
|
||||
PredictionTemplateDetailController,
|
||||
TelemetryController,
|
||||
CsrfController,
|
||||
LoginController,
|
||||
LogoutController,
|
||||
SessionController,
|
||||
WhoAmIController,
|
||||
UserProfileController,
|
||||
ChangePasswordController,
|
||||
ObtainTokenController,
|
||||
TokenManagementController,
|
||||
DeleteUserDataController,
|
||||
DeleteAccountController,
|
||||
)
|
||||
|
||||
|
||||
# A Router (prefix + routes) is required so build_schema() can generate the
|
||||
# OpenAPI document; see stratoflights/urls.py.
|
||||
router = Router(
|
||||
'api/',
|
||||
[
|
||||
path("csrf/", CsrfController.as_view(), name='api-csrf'),
|
||||
path('token', ObtainTokenController.as_view(), name='get_token'),
|
||||
path("login/", LoginController.as_view(), name='api-login'),
|
||||
path("logout/", LogoutController.as_view(), name='api-logout'),
|
||||
path("session/", SessionController.as_view(), name='api-session'),
|
||||
path("whoami/", WhoAmIController.as_view(), name='api-whoami'),
|
||||
path("<uuid:pk>/telemetry/", TelemetryController.as_view(), name="create_telemetry"),
|
||||
path("profile/", UserProfileController.as_view(), name='api-profile'),
|
||||
path("profile/change-password/", ChangePasswordController.as_view(), name='api-change-password'),
|
||||
path("profile/token/", TokenManagementController.as_view(), name='api-token'),
|
||||
path("profile/delete-data/", DeleteUserDataController.as_view(), name='api-delete-data'),
|
||||
path("profile/delete-account/", DeleteAccountController.as_view(), name='api-delete-account'),
|
||||
# Saved points (was SavedPointViewset via DefaultRouter).
|
||||
path("saved-points/", SavedPointListController.as_view(), name='saved-points-list'),
|
||||
path("saved-points/<int:pk>/", SavedPointDetailController.as_view(), name='saved-points-detail'),
|
||||
# Prediction templates (was PreditctionTemplateViewset via DefaultRouter).
|
||||
path("saved-templates/", PredictionTemplateListController.as_view(), name='saved-templates-list'),
|
||||
path("saved-templates/<int:pk>/", PredictionTemplateDetailController.as_view(), name='saved-templates-detail'),
|
||||
# Predictions (was PredictionViewSet via DefaultRouter).
|
||||
path("predictions/", PredictionCollectionController.as_view(), name='predictions-list'),
|
||||
path("predictions/list_user/", PredictionListUserController.as_view(), name='predictions-list-user'),
|
||||
path("predictions/history/", PredictionHistoryController.as_view(), name='predictions-history'),
|
||||
path("predictions/<uuid:pk>/detail/", PredictionDetailController.as_view(), name='predictions-detail'),
|
||||
path("predictions/<uuid:pk>/delete/", PredictionDeleteController.as_view(), name='predictions-delete'),
|
||||
],
|
||||
)
|
||||
|
||||
router = DefaultRouter()
|
||||
router.register(r'predictions', PredictionViewSet, basename='predictions')
|
||||
router.register(r'saved-points', SavedPointViewset, basename='saved-points')
|
||||
router.register(r'saved-templates', PreditctionTemplateViewset, basename='saved-templates')
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path("csrf/", get_csrf, name='api-csrf'),
|
||||
path('token', obtain_auth_token, name = 'get_token'),
|
||||
path("login/", login_view, name='api-login'),
|
||||
path("logout/", logout_view, name='api-logout'),
|
||||
path("session/", SessionView.as_view(), name='api-session'),
|
||||
path("whoami/", WhoAmIView.as_view(), name='api-whoami'),
|
||||
path("<uuid:pk>/telemetry/", TelemetryListCreateView.as_view(), name="create_telemetry"),
|
||||
path('csrf/', get_csrf, name='api-csrf'),
|
||||
path('login/', login_view, name='api-login'),
|
||||
path('logout/', logout_view, name='api-logout'),
|
||||
path('session/', SessionView.as_view(), name='api-session'),
|
||||
path('whoami/', WhoAmIView.as_view(), name='api-whoami'),
|
||||
path("profile/", UserProfileView.as_view(), name='api-profile'),
|
||||
path("profile/change-password/", ChangePasswordView.as_view(), name='api-change-password'),
|
||||
path("profile/token/", TokenManagementView.as_view(), name='api-token'),
|
||||
path("profile/delete-data/", DeleteUserDataView.as_view(), name='api-delete-data'),
|
||||
path("profile/delete-account/", DeleteAccountView.as_view(), name='api-delete-account'),
|
||||
]
|
||||
urlpatterns += router.urls
|
||||
urlpatterns = router.urls
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue