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 admin downloads list by its own table
Damian Legawiec757f0523763b
diff --git a/spree/api/app/controllers/spree/api/v3/admin/digital_links_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/digital_links_controller.rbindex 99a78bb562..f0583cc7ec 100644--- a/spree/api/app/controllers/spree/api/v3/admin/digital_links_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/admin/digital_links_controller.rb@@ -28,8 +28,14 @@ module SpreeSpree.api.admin_digital_link_serializerend+ # `digital_links` reaches links through line items, so the query+ # 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- current_store.digital_links+ current_store.digital_links.reorder("#{Spree::DigitalLink.table_name}.created_at": :desc)enddef scope_includes