Skip to content

Commit

Permalink
reformating with ruff and black
Browse files Browse the repository at this point in the history
  • Loading branch information
DrillableBit committed Jan 12, 2025
1 parent 8180f0d commit 8860fe0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 0 additions & 2 deletions aiarena/graphql/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from graphene_django import DjangoObjectType
from graphene_django.forms.mutation import _set_errors_flag_to_context
from graphene_django.types import ErrorType

from graphql import GraphQLError

from aiarena.core.utils import camel_case
Expand Down Expand Up @@ -232,4 +231,3 @@ def __init_subclass_with_meta__(cls, _meta=None, required_fields=None, **options
def raise_if_annonymous_user(info):
if not info.context.user.is_authenticated:
raise GraphQLError("You are not signed in")

5 changes: 3 additions & 2 deletions aiarena/graphql/mutations.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,21 @@ class UpdateBotInput(CleanedInputType):
bot_data_enabled = graphene.Boolean()
bot_data_publicly_downloadable = graphene.Boolean()


class UpdateBot(CleanedInputMutation):
bot = graphene.Field(BotType)

class Meta:
input_class = UpdateBotInput

@classmethod
def perform_mutate(cls, info: graphene.ResolveInfo, input_object: UpdateBotInput):
def perform_mutate(cls, info: graphene.ResolveInfo, input_object: UpdateBotInput):
raise_if_annonymous_user(info=info)

bot = graphene.Node.get_node_from_global_id(info=info, global_id=input_object.id, only_type=BotType)
if bot.user.id != info.context.user.id:
raise GraphQLError("This is not your bot")

for attr, value in input_object.items():
if attr == "id":
continue
Expand Down

0 comments on commit 8860fe0

Please sign in to comment.