uncloud-mravi/uncloud/urls.py
2021-12-26 21:19:03 +01:00

72 lines
2.9 KiB
Python

"""uncloud URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
"""
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 import routers
from rest_framework.schemas import get_schema_view
from uncloud_auth import views as authviews
from uncloud_net import views as netviews
from uncloud_pay import views as payviews
from uncloud_vm import views as vmviews
from . import views as uncloudviews
#import notifications.urls
router = routers.DefaultRouter()
# Beta endpoints
router.register(r'beta/vm', vmviews.NicoVMProductViewSet, basename='nicovmproduct')
################################################################################
# v2
# Net
router.register(r'v2/net/wireguardvpn', netviews.WireGuardVPNViewSet, basename='wireguardvpnnetwork')
router.register(r'v2/net/wireguardvpnsizes', netviews.WireGuardVPNSizes, basename='wireguardvpnnetworksizes')
# Payment related for a user
router.register(r'v2/payment/credit-card', payviews.CreditCardViewSet, basename='stripecreditcard')
router.register(r'v2/payment/payment', payviews.PaymentViewSet, basename='payment')
router.register(r'v2/payment/balance', payviews.BalanceViewSet, basename='payment-balance')
router.register(r'v2/payment/address', payviews.BillingAddressViewSet, basename='billingaddress')
router.register(r'v2/orders', payviews.OrderViewSet, basename='orders')
router.register(r'v2/bill', payviews.BillViewSet, basename='bills')
# Generic helper views that are usually not needed
router.register(r'v2/generic/vat-rate', payviews.VATRateViewSet, basename='vatrate')
urlpatterns = [
path(r'', uncloudviews.UncloudIndex.as_view(), name='uncloudindex'),
path(r'^/login', authviews.LoginView.as_view(), name='login'),
path(r'^/logout', authviews.LogoutView.as_view(), name='logout'),
path(r'api/', include(router.urls), name='api'),
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')), # for login to REST API
path('openapi', get_schema_view(
title="uncloud",
description="uncloud API",
version="2.0.0"
), name='openapi-schema'),
path('admin/', admin.site.urls),
#path('accounts/', include('allauth.urls')),
path('pricing/<slug:name>/calculate/', payviews.PricingView.as_view(), name='pricing_calculator'),
path('cc/reg/', payviews.RegisterCard.as_view(), name="cc_register"),
# path('inbox/notifications/', include(notifications.urls, namespace='notifications')),
path('payments/', include('uncloud_pay.urls', namespace='payments')),
#
]
# if env('ACTIVE_APP') == 'nextcloud':
# urlpatterns.append(path('', include('nextcloud.urls', namespace='nextcloud')))
# elif env('ACTIVE_APP') == 'matrixhosting':
# urlpatterns.append(path('', include('matrixhosting.urls', namespace='matrix')))