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

Class CreateLink

hackernews/backend-python/links/schema.py:51–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51class CreateLink(graphene.Mutation):
52 id = graphene.Int()
53 url = graphene.String()
54 description = graphene.String()
55 posted_by = graphene.Field(UserType)
56
57 class Arguments:
58 url = graphene.String()
59 description = graphene.String()
60
61 def mutate(self, info, url, description):
62 user = info.context.user or None
63
64 link = Link(
65 url=url,
66 description=description,
67 posted_by=user,
68 )
69 link.save()
70
71 return CreateLink(
72 id=link.id,
73 url=link.url,
74 description=link.description,
75 posted_by=link.posted_by,
76 )
77
78
79class CreateVote(graphene.Mutation):

Callers 1

mutateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected