import os from django.contrib import admin from django.urls import path, include from django.conf import settings from django.conf.urls.static import static from rest_framework.routers import DefaultRouter from rest_framework_simplejwt.views import TokenRefreshView from finance.views import ( AccountViewSet, TransactionViewSet, BudgetViewSet, ExpenseViewSet, DeadlineViewSet, ProfileView, RegisterView, LogoutView, ChangePasswordView, ICalUrlView, ICalFeedView, NotificationsView, SearchView, LoginView, TwoFactorLoginView, TwoFactorSetupView, TwoFactorEnableView, TwoFactorDisableView, TwoFactorRecoverRequestView, TwoFactorRecoverConfirmView, SessionListView, SessionRevokeView, SessionRevokeAllView, DataExportView, NotificationPrefsView, VerifyEmailView, PasswordResetRequestView, PasswordResetConfirmView, ) router = DefaultRouter() router.register(r'accounts', AccountViewSet, basename='account') router.register(r'transactions', TransactionViewSet, basename='transaction') router.register(r'budgets', BudgetViewSet, basename='budget') router.register(r'expenses', ExpenseViewSet, basename='expense') router.register(r'deadlines', DeadlineViewSet, basename='deadline') _admin_url = os.environ.get('ADMIN_URL', 'manage/').strip('/')+ '/' urlpatterns = [ path(_admin_url, admin.site.urls), path('api/', include(router.urls)), path('api/profile/', ProfileView.as_view()), path('api/auth/register/', RegisterView.as_view()), path('api/auth/token/', LoginView.as_view()), path('api/auth/token/refresh/', TokenRefreshView.as_view()), path('api/auth/logout/', LogoutView.as_view()), path('api/auth/password/', ChangePasswordView.as_view()), path('api/auth/verify-email/', VerifyEmailView.as_view()), path('api/auth/password-reset/', PasswordResetRequestView.as_view()), path('api/auth/password-reset/confirm/', PasswordResetConfirmView.as_view()), path('api/auth/2fa/login/', TwoFactorLoginView.as_view()), path('api/auth/2fa/setup/', TwoFactorSetupView.as_view()), path('api/auth/2fa/enable/', TwoFactorEnableView.as_view()), path('api/auth/2fa/disable/', TwoFactorDisableView.as_view()), path('api/auth/2fa/recover/', TwoFactorRecoverRequestView.as_view()), path('api/auth/2fa/recover/confirm/', TwoFactorRecoverConfirmView.as_view()), path('api/auth/sessions/', SessionListView.as_view()), path('api/auth/sessions/revoke-all/', SessionRevokeAllView.as_view()), path('api/auth/sessions//', SessionRevokeView.as_view()), path('api/export/', DataExportView.as_view()), path('api/notifications/prefs/', NotificationPrefsView.as_view()), path('api/search/', SearchView.as_view()), path('api/notifications/', NotificationsView.as_view()), path('api/calendar/ical-url/', ICalUrlView.as_view()), path('api/calendar/ical///', ICalFeedView.as_view()), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)