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

Class RelayCreateLink

hackernews/backend-python/links/schema_relay.py:38–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36
37
38class RelayCreateLink(graphene.relay.ClientIDMutation):
39 link = graphene.Field(LinkNode)
40
41 class Input:
42 url = graphene.String()
43 description = graphene.String()
44
45 def mutate_and_get_payload(root, info, **input):
46 user = info.context.user or None
47
48 link = Link(
49 url=input.get('url'),
50 description=input.get('description'),
51 posted_by=user,
52 )
53 link.save()
54
55 return RelayCreateLink(link=link)
56
57
58class RelayMutation(graphene.AbstractType):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected