Include address in DFC Enterprise endpoint

This commit is contained in:
Maikel Linke
2023-08-24 16:51:36 +10:00
parent 20b09b5352
commit 1c3574ce79
3 changed files with 9 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ module DfcProvider
enterprise = EnterpriseBuilder.enterprise(current_enterprise)
render json: DfcIo.export(
enterprise,
*enterprise.localizations,
*enterprise.suppliedProducts,
*enterprise.catalogItems,
)

View File

@@ -9,7 +9,7 @@ describe "Enterprises", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml", rs
:distributor_enterprise,
id: 10_000, owner: user, abn: "123 456", name: "Fred's Farm",
description: "This is an awesome enterprise",
address: build(:address, id: 40_000),
address: build(:address, id: 40_000, address1: "42 Doveton Street"),
)
end
let!(:product) {
@@ -47,6 +47,7 @@ describe "Enterprises", type: :request, swagger_doc: "dfc-v1.7/swagger.yaml", rs
expect(response.body).to include "This is an awesome enterprise"
expect(response.body).to include "123 456"
expect(response.body).to include "Apple"
expect(response.body).to include "42 Doveton Street"
end
end
end

View File

@@ -253,6 +253,12 @@ paths:
dfc-b:VATnumber: 123 456
dfc-b:supplies: http://test.host/api/dfc-v1.7/enterprises/10000/supplied_products/10001
dfc-b:manages: http://test.host/api/dfc-v1.7/enterprises/10000/catalog_items/10001
- "@id": http://test.host/api/dfc-v1.7/addresses/40000
"@type": dfc-b:Address
dfc-b:hasStreet: 42 Doveton Street
dfc-b:hasPostalCode: '20170'
dfc-b:hasCity: Herndon
dfc-b:hasCountry: Australia
- "@id": http://test.host/api/dfc-v1.7/enterprises/10000/supplied_products/10001
"@type": dfc-b:SuppliedProduct
dfc-b:name: Apple