Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Order the customer downloads list by its own table
Damian Legawiec123a209a1c73
diff --git a/spree/api/app/controllers/spree/api/v3/store/customer/digital_links_controller.rb b/spree/api/app/controllers/spree/api/v3/store/customer/digital_links_controller.rbindex fe62281909..565a581968 100644--- a/spree/api/app/controllers/spree/api/v3/store/customer/digital_links_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/store/customer/digital_links_controller.rb@@ -27,8 +27,15 @@ module Spree:digital_linksend+ # The `digital_links` association reaches links through orders and+ # line items, so it carries a DISTINCT and inherits an ORDER BY on+ # the line items' table. PostgreSQL rejects DISTINCT combined with+ # an ORDER BY column outside the select list, so reorder by the+ # links' own table — SQLite tolerates the inherited order, so this+ # only surfaces on a real deployment.def scope- super.where(spree_orders: { store_id: current_store.id }).order(created_at: :desc)+ super.where(spree_orders: { store_id: current_store.id })+ .reorder("#{Spree::DigitalLink.table_name}.created_at": :desc)end# The serializer asks each link whether it is still authorizable,