urls.py 2.7 KB

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