Added item_listing query
+ items can be searched or all items can be returned + Added missing migrationdoc_update
parent
2f846de921
commit
9eabf09fc0
|
@ -35,6 +35,10 @@ class ItemListingType(DjangoObjectType):
|
||||||
fields = ("item_name", "price", "amount", "date_restocked", "normalized_price", "id")
|
fields = ("item_name", "price", "amount", "date_restocked", "normalized_price", "id")
|
||||||
|
|
||||||
normalized_price = graphene.Float()
|
normalized_price = graphene.Float()
|
||||||
|
shop = graphene.Field("GeoffreyApp.api.schema.ShopType")
|
||||||
|
|
||||||
|
def resolve_shop(self, info):
|
||||||
|
return self.shop
|
||||||
|
|
||||||
|
|
||||||
class ResourceType(DjangoObjectType):
|
class ResourceType(DjangoObjectType):
|
||||||
|
@ -146,6 +150,7 @@ class Query(graphene.ObjectType):
|
||||||
bases = graphene.List(BaseType, id=graphene.Argument(graphene.Int, required=False), name=graphene.Argument(graphene.String, required=False))
|
bases = graphene.List(BaseType, id=graphene.Argument(graphene.Int, required=False), name=graphene.Argument(graphene.String, required=False))
|
||||||
attractions = graphene.List(AttractionType, id=graphene.Argument(graphene.Int, required=False), name=graphene.Argument(graphene.String, required=False))
|
attractions = graphene.List(AttractionType, id=graphene.Argument(graphene.Int, required=False), name=graphene.Argument(graphene.String, required=False))
|
||||||
points_of_interest = graphene.List(PointOfInterestType, id=graphene.Argument(graphene.Int, required=False), name=graphene.Argument(graphene.String, required=False))
|
points_of_interest = graphene.List(PointOfInterestType, id=graphene.Argument(graphene.Int, required=False), name=graphene.Argument(graphene.String, required=False))
|
||||||
|
item_listing = graphene.List(ItemListingType, item=graphene.Argument(graphene.String, required=False))
|
||||||
|
|
||||||
@ProtectedAPI.protected_api()
|
@ProtectedAPI.protected_api()
|
||||||
def resolve_player(root, info, id=None, name=None, discord_uuid=None, mc_uuid=None):
|
def resolve_player(root, info, id=None, name=None, discord_uuid=None, mc_uuid=None):
|
||||||
|
@ -161,7 +166,6 @@ class Query(graphene.ObjectType):
|
||||||
|
|
||||||
return query.get()
|
return query.get()
|
||||||
|
|
||||||
|
|
||||||
@ProtectedAPI.protected_api()
|
@ProtectedAPI.protected_api()
|
||||||
def resolve_locations(root, info, id=None, name=None):
|
def resolve_locations(root, info, id=None, name=None):
|
||||||
return get_location(root, info, id=id, name=name, location_type=Location)
|
return get_location(root, info, id=id, name=name, location_type=Location)
|
||||||
|
@ -190,6 +194,14 @@ class Query(graphene.ObjectType):
|
||||||
def resolved_points_of_interest(root, info, id=None, name=None):
|
def resolved_points_of_interest(root, info, id=None, name=None):
|
||||||
return get_location(root, info, id=id, name=name, location_type=PointOfInterest)
|
return get_location(root, info, id=id, name=name, location_type=PointOfInterest)
|
||||||
|
|
||||||
|
@ProtectedAPI.protected_api()
|
||||||
|
def resolve_item_listing(root, info, item=None):
|
||||||
|
query = ItemListing.objects
|
||||||
|
if item is not None:
|
||||||
|
query = query.filter(item_name=item)
|
||||||
|
|
||||||
|
return query.all()
|
||||||
|
|
||||||
|
|
||||||
def get_location(root, info, id=None, name=None, location_type=Location):
|
def get_location(root, info, id=None, name=None, location_type=Location):
|
||||||
if id is not None:
|
if id is not None:
|
||||||
|
|
Loading…
Reference in New Issue