fix: Improve performance of most hit APIs in widget (#11089)

- Cache campaigns for better performance
- Fix N+1 queries in inbox members
- Remove unused related articles
This commit is contained in:
Pranav
2025-03-14 17:37:36 -07:00
committed by GitHub
parent ed970ee190
commit 46ec92c86e
6 changed files with 47 additions and 31 deletions

View File

@@ -4,26 +4,6 @@ json.locale category.locale
json.description category.description
json.position category.position
json.related_categories do
if category.related_categories.any?
json.array! category.related_categories.each do |related_category|
json.partial! partial: 'public/api/v1/models/associated_category', formats: [:json], category: related_category
end
end
end
if category.parent_category.present?
json.parent_category do
json.partial! partial: 'public/api/v1/models/associated_category', formats: [:json], category: category.parent_category
end
end
if category.root_category.present?
json.root_category do
json.partial! partial: 'public/api/v1/models/associated_category', formats: [:json], category: category.root_category
end
end
json.meta do
json.articles_count category.articles.published.size
end