urls.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. from django.urls import path, include
  2. from rest_framework_nested import routers
  3. from issues.views import IssueViewSet
  4. from teams.views import NestedTeamViewSet
  5. from environments.views import EnvironmentViewSet
  6. from releases.views import ReleaseViewSet, ReleaseFileViewSet
  7. from performance.views import TransactionViewSet, TransactionGroupViewSet, SpanViewSet
  8. from glitchtip.uptime.views import MonitorViewSet, MonitorCheckViewSet
  9. from glitchtip.routers import BulkSimpleRouter
  10. from .views import (
  11. OrganizationViewSet,
  12. OrganizationUserViewSet,
  13. OrganizationMemberViewSet,
  14. OrganizationProjectsViewSet,
  15. AcceptInviteView,
  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. ]