urls.py 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. from django.urls import include, path
  2. from rest_framework_nested import routers
  3. from apps.environments.views import EnvironmentViewSet
  4. from apps.performance.views import (
  5. SpanViewSet,
  6. TransactionGroupViewSet,
  7. TransactionViewSet,
  8. )
  9. from apps.projects.views import OrganizationProjectsViewSet
  10. from apps.releases.views import ReleaseFileViewSet, ReleaseViewSet
  11. from apps.teams.views import NestedTeamViewSet
  12. from apps.uptime.views import (
  13. MonitorCheckViewSet,
  14. MonitorViewSet,
  15. StatusPageViewSet,
  16. )
  17. from glitchtip.routers import BulkSimpleRouter
  18. from .views import (
  19. AcceptInviteView,
  20. OrganizationMemberViewSet,
  21. OrganizationUserViewSet,
  22. OrganizationViewSet,
  23. )
  24. router = BulkSimpleRouter()
  25. router.register(r"organizations", OrganizationViewSet)
  26. organizations_router = routers.NestedSimpleRouter(
  27. router, r"organizations", lookup="organization"
  28. )
  29. organizations_router.register(
  30. r"teams", NestedTeamViewSet, basename="organization-teams"
  31. )
  32. organizations_router.register(
  33. r"members", OrganizationMemberViewSet, basename="organization-members"
  34. )
  35. organizations_router.register(
  36. r"users", OrganizationUserViewSet, basename="organization-users"
  37. )
  38. organizations_router.register(
  39. r"projects", OrganizationProjectsViewSet, basename="organization-projects"
  40. )
  41. organizations_router.register(
  42. r"environments", EnvironmentViewSet, basename="organization-environments"
  43. )
  44. organizations_router.register(
  45. r"transactions", TransactionViewSet, basename="organization-transactions"
  46. )
  47. organizations_router.register(
  48. r"transaction-groups",
  49. TransactionGroupViewSet,
  50. basename="organization-transaction-groups",
  51. )
  52. organizations_router.register(
  53. r"spans",
  54. SpanViewSet,
  55. basename="organization-spans",
  56. )
  57. organizations_router.register(
  58. r"monitors", MonitorViewSet, basename="organization-monitors"
  59. )
  60. organizations_router.register(
  61. r"status-pages", StatusPageViewSet, basename="organization-status-pages"
  62. )
  63. organizations_monitors_router = routers.NestedSimpleRouter(
  64. organizations_router, r"monitors", lookup="monitor"
  65. )
  66. organizations_monitors_router.register(
  67. r"checks", MonitorCheckViewSet, basename="organization-monitor-checks"
  68. )
  69. organizations_router.register(
  70. r"releases", ReleaseViewSet, basename="organization-releases"
  71. )
  72. organizations_releases_router = routers.NestedSimpleRouter(
  73. organizations_router, r"releases", lookup="release"
  74. )
  75. organizations_releases_router.register(
  76. r"files", ReleaseFileViewSet, basename="organization-release-files"
  77. )
  78. urlpatterns = [
  79. path("", include(router.urls)),
  80. path("", include(organizations_router.urls)),
  81. path("", include(organizations_monitors_router.urls)),
  82. path("", include(organizations_releases_router.urls)),
  83. path(
  84. "accept/<int:org_user_id>/<token>/",
  85. AcceptInviteView.as_view(),
  86. name="accept-invite",
  87. ),
  88. ]