diff --git a/apps/entry/dataloaders.py b/apps/entry/dataloaders.py index 1dd0df1816..5045988386 100644 --- a/apps/entry/dataloaders.py +++ b/apps/entry/dataloaders.py @@ -120,27 +120,6 @@ def batch_load_fn(self, keys): return Promise.resolve([counts.get(key, 0) for key in keys]) -class EntryImageUrlLoader(DataLoaderWithContext): - def batch_load_fn(self, keys): - entry_qs = Entry.objects.filter(id__in=keys) - entry_dict = {entry.id: entry for entry in entry_qs} - results = [] - for key in keys: - entry = entry_dict.get(key) - if entry.entry_type == Entry.TagType.IMAGE: - url = self.context.request.build_absolute_uri( - URLCachedFileField.name_to_representation(entry.image) - ) - elif entry.entry_type == Entry.TagType.ATTACHMENT: - url = self.context.request.build_absolute_uri( - URLCachedFileField.name_to_representation(entry.entry_attachment.file) - ) - else: - url = None - results.append(url) - return Promise.resolve(results) - - class DataLoaders(WithContextMixin): @cached_property def entry(self): @@ -173,7 +152,3 @@ def verified_by(self): @cached_property def verified_by_count(self): return EntryVerifiedByCountLoader(context=self.context) - - @cached_property - def entry_image_preview_url(self): - return EntryImageUrlLoader(context=self.context) diff --git a/apps/entry/schema.py b/apps/entry/schema.py index 34f43282ca..b11e995194 100644 --- a/apps/entry/schema.py +++ b/apps/entry/schema.py @@ -118,7 +118,6 @@ class Meta: review_comments_count = graphene.Int(required=True) draft_entry = graphene.ID(source="draft_entry_id") entry_attachment = graphene.Field(EntryAttachmentType, required=False) - canonical_preview_image = graphene.String(required=False) # project_labels TODO: # tabular_field TODO: @@ -153,11 +152,6 @@ def resolve_verified_by_count(root, info, **_): return len(root.verified_by.all()) return info.context.dl.entry.verified_by_count.load(root.pk) - @staticmethod - # NOTE: Client might not need this field so we have not refactor the dataloader - def resolve_canonical_preview_image(root, info, **_): - return info.context.dl.entry.entry_image_preview_url.load(root.pk) - class EntryListType(CustomDjangoListObjectType): class Meta: diff --git a/schema.graphql b/schema.graphql index 0cbf925e9d..d01ad62fc4 100644 --- a/schema.graphql +++ b/schema.graphql @@ -4101,7 +4101,6 @@ type EntryType { reviewCommentsCount: Int! draftEntry: ID entryAttachment: EntryAttachmentType - canonicalPreviewImage: String } scalar EnumDescription