MCPcopy Create free account
hub / github.com/alpha2phi/python-apps / mutate

Method mutate

hackernews/backend-python/links/schema.py:86–100  ·  view source on GitHub ↗
(self, info, link_id)

Source from the content-addressed store, hash-verified

84 link_id = graphene.Int()
85
86 def mutate(self, info, link_id):
87 user = info.context.user
88 if user.is_anonymous:
89 raise GraphQLError('You must be logged to vote!')
90
91 link = Link.objects.filter(id=link_id).first()
92 if not link:
93 raise Exception('Invalid Link!')
94
95 Vote.objects.create(
96 user=user,
97 link=link,
98 )
99
100 return CreateVote(user=user, link=link)
101
102
103class VoteType(DjangoObjectType):

Callers

nothing calls this directly

Calls 2

CreateVoteClass · 0.85
createMethod · 0.80

Tested by

no test coverage detected