Skip to content

Commit

Permalink
Merge branch 'staging'
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjohnson committed Jun 17, 2024
2 parents 6a6b6d1 + 3df59e5 commit 0c3f7e5
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions api_v2/serializers/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,14 @@ def get_document(self, obj):

def get_route(self, obj):
"""Route is a way to build the link to the object."""

route_lookup = {
"Condition":"conditions",
"Item":"items",
"Creature":"creatures",
"Spell":"spells",
"CharacterClass":"classes",
"Monster":"monsters",
"MagicItem":"magicitems",
"Section":"sections",
"Background":"backgrounds",
"Subrace":"subraces",
"Feat":"feats",
"Race":"races",
"Plane":"planes",
"CharClass":"classes",
"Environment":"environments"
}


route = f"{obj.schema_version}/{route_lookup[obj.object_model]}/"
if obj.object_model in route_lookup.keys():
route = f"{obj.schema_version}/{route_lookup[obj.object_model]}/"
else:
route = f"{obj.schema_version}/{obj.object_model.lower()}s/"
return route

0 comments on commit 0c3f7e5

Please sign in to comment.