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
Stop promising a null the company schema cannot produce
Łukasz Adamczyk93626616a09d
diff --git a/spree/api/app/serializers/spree/api/v3/admin/company_contact_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/company_contact_serializer.rbindex b4037b52b7..d93c4a1223 100644--- a/spree/api/app/serializers/spree/api/v3/admin/company_contact_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/admin/company_contact_serializer.rb@@ -8,18 +8,21 @@ module Spreeattributes :role, created_at: :iso8601, updated_at: :iso8601+ # Both associations are required, so these are never null and the+ # types above say so. Safe navigation here would have promised a null+ # the schema cannot produce.attribute :company_location_id do |contact|- contact.company_location&.prefixed_id+ contact.company_location.prefixed_idendattribute :customer_id do |contact|- contact.customer&.prefixed_id+ contact.customer.prefixed_idend# The dashboard lists contacts by who they are, and would otherwise# need a customer request per row.attribute :email do |contact|- contact.customer&.email+ contact.customer.emailendendenddiff --git a/spree/api/app/serializers/spree/api/v3/admin/company_location_serializer.rb b/spree/api/app/serializers/spree/api/v3/admin/company_location_serializer.rbindex 37f396f717..8961593826 100644--- a/spree/api/app/serializers/spree/api/v3/admin/company_location_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/admin/company_location_serializer.rb@@ -15,8 +15,9 @@ module Spreeattributes :name, :external_id, :metadata,created_at: :iso8601, updated_at: :iso8601+ # A branch always belongs to a company, so this is never null.attribute :company_id do |location|- location.company&.prefixed_id+ location.company.prefixed_idendattribute :contacts_count do |location|