Fix Snapshot error with heroImage
This commit is contained in:
parent
553fa041b7
commit
63bed54de1
|
|
@ -2025,7 +2025,7 @@ export type SnapshotNode = Node & {
|
||||||
chapters?: Maybe<Array<Maybe<SnapshotChapterNode>>>;
|
chapters?: Maybe<Array<Maybe<SnapshotChapterNode>>>;
|
||||||
created: Scalars['DateTime']['output'];
|
created: Scalars['DateTime']['output'];
|
||||||
creator: Scalars['String']['output'];
|
creator: Scalars['String']['output'];
|
||||||
heroImage?: Maybe<Scalars['String']['output']>;
|
heroImage?: Maybe<WagtailImageNode>;
|
||||||
hiddenContentBlocks: ContentBlockNodeConnection;
|
hiddenContentBlocks: ContentBlockNodeConnection;
|
||||||
hiddenObjectives: ObjectiveNodeConnection;
|
hiddenObjectives: ObjectiveNodeConnection;
|
||||||
/** The ID of the object */
|
/** The ID of the object */
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,12 @@ query SnapshotDetail($id: ID!) {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
metaTitle
|
metaTitle
|
||||||
heroImage
|
heroImage {
|
||||||
|
id
|
||||||
|
src
|
||||||
|
srcset
|
||||||
|
alt
|
||||||
|
}
|
||||||
created
|
created
|
||||||
changes {
|
changes {
|
||||||
newContentBlocks
|
newContentBlocks
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from graphene import relay, ObjectType
|
||||||
from graphene_django import DjangoObjectType
|
from graphene_django import DjangoObjectType
|
||||||
|
|
||||||
from books.models.snapshot import Snapshot
|
from books.models.snapshot import Snapshot
|
||||||
|
from books.schema.nodes.wagtail_image import WagtailImageNode
|
||||||
from ..interfaces import ChapterInterface
|
from ..interfaces import ChapterInterface
|
||||||
from ..interfaces.contentblock import ContentBlockInterface
|
from ..interfaces.contentblock import ContentBlockInterface
|
||||||
from ...models import ContentBlock
|
from ...models import ContentBlock
|
||||||
|
|
@ -116,7 +117,7 @@ class SnapshotNode(DjangoObjectType):
|
||||||
title = graphene.String()
|
title = graphene.String()
|
||||||
chapters = graphene.List(SnapshotChapterNode)
|
chapters = graphene.List(SnapshotChapterNode)
|
||||||
meta_title = graphene.String()
|
meta_title = graphene.String()
|
||||||
hero_image = graphene.String()
|
hero_image = graphene.Field(WagtailImageNode)
|
||||||
changes = graphene.Field(SnapshotChangesNode)
|
changes = graphene.Field(SnapshotChangesNode)
|
||||||
mine = graphene.Boolean()
|
mine = graphene.Boolean()
|
||||||
shared = graphene.Boolean(required=True)
|
shared = graphene.Boolean(required=True)
|
||||||
|
|
@ -149,9 +150,7 @@ class SnapshotNode(DjangoObjectType):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_hero_image(parent, info, **kwargs):
|
def resolve_hero_image(parent, info, **kwargs):
|
||||||
if parent.module.hero_image:
|
return parent.module.hero_image
|
||||||
return parent.module.hero_image.file.url
|
|
||||||
return ''
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def resolve_changes(parent, info, **kwargs):
|
def resolve_changes(parent, info, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -576,7 +576,7 @@ type SnapshotNode implements Node {
|
||||||
hiddenObjectives(offset: Int, before: String, after: String, first: Int, last: Int, text: String): ObjectiveNodeConnection!
|
hiddenObjectives(offset: Int, before: String, after: String, first: Int, last: Int, text: String): ObjectiveNodeConnection!
|
||||||
title: String
|
title: String
|
||||||
metaTitle: String
|
metaTitle: String
|
||||||
heroImage: String
|
heroImage: WagtailImageNode
|
||||||
changes: SnapshotChangesNode
|
changes: SnapshotChangesNode
|
||||||
mine: Boolean
|
mine: Boolean
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue