Skip to content

Commit

Permalink
Organizing urls a bit better. Should be non-functional change.
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjohnson committed Oct 19, 2024
1 parent a7d9c91 commit ff0b53d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 79 deletions.
20 changes: 20 additions & 0 deletions api/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from rest_framework import routers

from api import views

router = routers.DefaultRouter()
router.register(r'manifest', views.ManifestViewSet)
router.register(r'spells', views.SpellViewSet)
router.register(r'spelllist',views.SpellListViewSet)
router.register(r'monsters', views.MonsterViewSet)
router.register(r'documents', views.DocumentViewSet)
router.register(r'backgrounds', views.BackgroundViewSet)
router.register(r'planes', views.PlaneViewSet)
router.register(r'sections', views.SectionViewSet)
router.register(r'feats', views.FeatViewSet)
router.register(r'conditions', views.ConditionViewSet)
router.register(r'races',views.RaceViewSet)
router.register(r'classes',views.CharClassViewSet)
router.register(r'magicitems',views.MagicItemViewSet)
router.register(r'weapons',views.WeaponViewSet)
router.register(r'armor',views.ArmorViewSet)
37 changes: 37 additions & 0 deletions api_v2/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

from rest_framework import routers

from api_v2 import views

router = routers.DefaultRouter()
router.register(r'items',views.ItemViewSet)
router.register(r'itemsets',views.ItemSetViewSet)
router.register(r'itemcategories',views.ItemCategoryViewSet)
router.register(r'documents',views.DocumentViewSet)
router.register(r'licenses',views.LicenseViewSet)
router.register(r'publishers',views.PublisherViewSet)
router.register(r'weapons',views.WeaponViewSet)
router.register(r'armor',views.ArmorViewSet)
router.register(r'gamesystems',views.GameSystemViewSet)
router.register(r'backgrounds',views.BackgroundViewSet)
router.register(r'feats',views.FeatViewSet)
router.register(r'races',views.RaceViewSet)
router.register(r'creatures',views.CreatureViewSet)
router.register(r'creaturetypes',views.CreatureTypeViewSet)
router.register(r'creaturesets',views.CreatureSetViewSet)
router.register(r'damagetypes',views.DamageTypeViewSet)
router.register(r'languages',views.LanguageViewSet)
router.register(r'alignments',views.AlignmentViewSet)
router.register(r'conditions',views.ConditionViewSet)
router.register(r'spells',views.SpellViewSet)
router.register(r'classes',views.CharacterClassViewSet)
router.register(r'sizes',views.SizeViewSet)
router.register(r'itemrarities',views.ItemRarityViewSet)
router.register(r'environments',views.EnvironmentViewSet)
router.register(r'abilities',views.AbilityViewSet)
router.register(r'skills',views.SkillViewSet)
router.register(r'rules', views.RuleViewSet)
router.register(r'rulesets', views.RuleSetViewSet)

search_router = routers.DefaultRouter()
search_router.register('',views.SearchResultViewSet, basename='search')
90 changes: 11 additions & 79 deletions server/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,92 +15,24 @@
"""

from django.conf.urls import include
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

from django.contrib import admin
from django.urls import path
from django.conf import settings

from rest_framework import routers
from api import urls as v1_urls
from api.views import get_version
from api_v2 import urls as v2_urls
from api_v2.views import get_enums

from api import views
from api_v2 import views as views_v2

router = routers.DefaultRouter()
#router.register(r'users', views.UserViewSet)
#router.register(r'groups', views.GroupViewSet)
router.register(r'manifest', views.ManifestViewSet)
router.register(r'spells', views.SpellViewSet)
router.register(r'spelllist',views.SpellListViewSet)
router.register(r'monsters', views.MonsterViewSet)
router.register(r'documents', views.DocumentViewSet)
router.register(r'backgrounds', views.BackgroundViewSet)
router.register(r'planes', views.PlaneViewSet)
router.register(r'sections', views.SectionViewSet)
router.register(r'feats', views.FeatViewSet)
router.register(r'conditions', views.ConditionViewSet)
router.register(r'races',views.RaceViewSet)
#router.register(r'subraces',views.SubraceViewSet)
router.register(r'classes',views.CharClassViewSet)
#router.register(r'archetypes',views.ArchetypeViewSet)
router.register(r'magicitems',views.MagicItemViewSet)
router.register(r'weapons',views.WeaponViewSet)
router.register(r'armor',views.ArmorViewSet)

#router.register('search', views.SearchView, basename="global-search")


router_v2 = routers.DefaultRouter()

router_v2.register(r'items',views_v2.ItemViewSet)
router_v2.register(r'itemsets',views_v2.ItemSetViewSet)
router_v2.register(r'itemcategories',views_v2.ItemCategoryViewSet)
router_v2.register(r'documents',views_v2.DocumentViewSet)
router_v2.register(r'licenses',views_v2.LicenseViewSet)
router_v2.register(r'publishers',views_v2.PublisherViewSet)
router_v2.register(r'weapons',views_v2.WeaponViewSet)
router_v2.register(r'armor',views_v2.ArmorViewSet)
router_v2.register(r'gamesystems',views_v2.GameSystemViewSet)
router_v2.register(r'backgrounds',views_v2.BackgroundViewSet)
router_v2.register(r'feats',views_v2.FeatViewSet)
router_v2.register(r'races',views_v2.RaceViewSet)
router_v2.register(r'creatures',views_v2.CreatureViewSet)
router_v2.register(r'creaturetypes',views_v2.CreatureTypeViewSet)
router_v2.register(r'creaturesets',views_v2.CreatureSetViewSet)
router_v2.register(r'damagetypes',views_v2.DamageTypeViewSet)
router_v2.register(r'languages',views_v2.LanguageViewSet)
router_v2.register(r'alignments',views_v2.AlignmentViewSet)
router_v2.register(r'conditions',views_v2.ConditionViewSet)
router_v2.register(r'spells',views_v2.SpellViewSet)
router_v2.register(r'classes',views_v2.CharacterClassViewSet)
router_v2.register(r'sizes',views_v2.SizeViewSet)
router_v2.register(r'itemrarities',views_v2.ItemRarityViewSet)
router_v2.register(r'environments',views_v2.EnvironmentViewSet)
router_v2.register(r'abilities',views_v2.AbilityViewSet)
router_v2.register(r'skills',views_v2.SkillViewSet)
router_v2.register(r'rules', views_v2.RuleViewSet)
router_v2.register(r'rulesets', views_v2.RuleSetViewSet)

router_search = routers.DefaultRouter()

router_search.register('',views_v2.SearchResultViewSet, basename='search')


# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
path('', include(router.urls)),
#url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
#path('search/', include('haystack.urls')),
path('version/', views.get_version, name="version"),
path('v2/enums/', views_v2.get_enums, name="enums"),


# Versioned API routes (above routes default to v1)
path('v1/', include(router.urls)),
#path('v1/search/', include('haystack.urls')),
path('v2/', include(router_v2.urls)),
path('v2/search/', include(router_search.urls))
path('', include(v1_urls.router.urls)),
path('version/', get_version, name="version"),
path('v1/', include(v1_urls.router.urls)),

path('v2/', include(v2_urls.router.urls)),
path('v2/search/', include(v2_urls.search_router.urls)),
path('v2/enums/', get_enums, name="enums")
]

if settings.DEBUG is True:
Expand Down

0 comments on commit ff0b53d

Please sign in to comment.