urls.py 2.9 KB

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