urls.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. from django.urls import include, path
  2. from rest_framework_nested import routers
  3. from apps.performance.views import (
  4. SpanViewSet,
  5. TransactionGroupViewSet,
  6. TransactionViewSet,
  7. )
  8. from apps.uptime.views import (
  9. MonitorCheckViewSet,
  10. MonitorViewSet,
  11. StatusPageViewSet,
  12. )
  13. from glitchtip.routers import BulkSimpleRouter
  14. from .views import OrganizationViewSet
  15. router = BulkSimpleRouter()
  16. router.register(r"organizations", OrganizationViewSet)
  17. organizations_router = routers.NestedSimpleRouter(
  18. router, r"organizations", lookup="organization"
  19. )
  20. organizations_router.register(
  21. r"transactions", TransactionViewSet, basename="organization-transactions"
  22. )
  23. organizations_router.register(
  24. r"transaction-groups",
  25. TransactionGroupViewSet,
  26. basename="organization-transaction-groups",
  27. )
  28. organizations_router.register(
  29. r"spans",
  30. SpanViewSet,
  31. basename="organization-spans",
  32. )
  33. organizations_router.register(
  34. r"monitors", MonitorViewSet, basename="organization-monitors"
  35. )
  36. organizations_router.register(
  37. r"status-pages", StatusPageViewSet, basename="organization-status-pages"
  38. )
  39. organizations_monitors_router = routers.NestedSimpleRouter(
  40. organizations_router, r"monitors", lookup="monitor"
  41. )
  42. organizations_monitors_router.register(
  43. r"checks", MonitorCheckViewSet, basename="organization-monitor-checks"
  44. )
  45. urlpatterns = [
  46. path("", include(router.urls)),
  47. path("", include(organizations_router.urls)),
  48. path("", include(organizations_monitors_router.urls)),
  49. ]