From ebb59d1eefb51d66af80ee4a3dd3f117c4c12cbf Mon Sep 17 00:00:00 2001 From: Juan Ferrer Toribio Date: Fri, 12 May 2017 13:36:12 +0200 Subject: [PATCH] Errores en relaciones solucionados --- client/client/src/card/index.js | 2 +- services/client/common/models/Address.json | 6 ++--- .../client/common/models/AgencyService.json | 4 ++-- services/client/common/models/Client.json | 22 ++++++++++--------- .../common/models/ClientObservation.json | 4 ++-- services/client/common/models/Country.json | 4 ++-- services/client/common/models/Employee.json | 2 +- services/client/common/models/Province.json | 6 ++--- 8 files changed, 26 insertions(+), 24 deletions(-) diff --git a/client/client/src/card/index.js b/client/client/src/card/index.js index aa61f8770..514950de7 100644 --- a/client/client/src/card/index.js +++ b/client/client/src/card/index.js @@ -7,7 +7,7 @@ export const COMPONENT = { controllerAs: 'card', controller: function($http, $stateParams) { this.client = null; - $http.get(`/client/api/Clients/${$stateParams.id}?filter[include][accountFk]`).then( + $http.get(`/client/api/Clients/${$stateParams.id}?filter[include][account]`).then( json => this.client = json.data ); diff --git a/services/client/common/models/Address.json b/services/client/common/models/Address.json index 1bdf0b771..f779be6d8 100644 --- a/services/client/common/models/Address.json +++ b/services/client/common/models/Address.json @@ -44,17 +44,17 @@ }, "validations": [], "relations": { - "provinceFk": { + "province": { "type": "belongsTo", "model": "Province", "foreignKey": "provinceFk" }, - "clientFk": { + "client": { "type": "belongsTo", "model": "Client", "foreignKey": "clientFk" }, - "defaultAgencyFk": { + "defaultAgency": { "type": "belongsTo", "model": "Agency", "foreignKey": "defaultAgencyFk" diff --git a/services/client/common/models/AgencyService.json b/services/client/common/models/AgencyService.json index 94e6a3198..57c2b51ac 100644 --- a/services/client/common/models/AgencyService.json +++ b/services/client/common/models/AgencyService.json @@ -26,12 +26,12 @@ } }, "relations": { - "agencyFk": { + "agency": { "type": "belongsTo", "model": "Agency", "foreignKey": "agencyFk" }, - "agencyTypeFk": { + "agencyType": { "type": "belongsTo", "model": "AgencyType", "foreignKey": "agencyTypeFk" diff --git a/services/client/common/models/Client.json b/services/client/common/models/Client.json index 74fadc828..c350ea224 100644 --- a/services/client/common/models/Client.json +++ b/services/client/common/models/Client.json @@ -94,46 +94,48 @@ "isRelevant": { "type": "boolean" }, - "typeFk": { - "type": "Number" - }, "accountingAccount": { "type": "string" } }, "validations": [], "relations": { - "accountFk": { + "account": { "type": "belongsTo", "model": "Account", "foreignKey": "id" }, - "payMethodFk": { + "payMethod": { "type": "belongsTo", "model": "PayMethod", "foreignKey": "payMethodFk" }, - "salesPersonFk": { + "salesPerson": { "type": "belongsTo", "model": "Employee", "foreignKey": "salesPersonFk" }, - "provinceFk":{ + "province":{ "type": "belongsTo", "model": "Province", "foreignKey": "provinceFk" }, - "countryFk":{ + "country":{ "type": "belongsTo", "model": "Country", "foreignKey": "countryFk" }, - "contactChannelFk":{ + "contactChannel":{ "type": "belongsTo", "model": "ContactChannel", "foreignKey": "contactChannelFk" }, - "addressesFk": { + "type": { + "type": "belongsTo", + "model": "ClientType", + "foreignKey": "typeFk" + }, + "addresses": { "type": "hasMany", "model": "Address", "foreignKey": "clientFk" diff --git a/services/client/common/models/ClientObservation.json b/services/client/common/models/ClientObservation.json index 373eeb821..ed39aacca 100644 --- a/services/client/common/models/ClientObservation.json +++ b/services/client/common/models/ClientObservation.json @@ -22,12 +22,12 @@ } }, "relations": { - "employeeFk": { + "employee": { "type": "belongsTo", "model": "Employee", "foreignKey": "employeeFk" }, - "clientFk": { + "client": { "type": "hasOne", "model": "Client", "foreignKey": "id" diff --git a/services/client/common/models/Country.json b/services/client/common/models/Country.json index 60d295c40..d695b24bd 100644 --- a/services/client/common/models/Country.json +++ b/services/client/common/models/Country.json @@ -20,12 +20,12 @@ } }, "relations": { - "currencyFk": { + "currency": { "type": "belongsTo", "model": "Currency", "foreignKey": "currencyFk" }, - "realCountryFk": { + "realCountry": { "type": "belongsTo", "model": "Country", "foreignKey": "realCountryFk" diff --git a/services/client/common/models/Employee.json b/services/client/common/models/Employee.json index 482cdf017..3218933d8 100644 --- a/services/client/common/models/Employee.json +++ b/services/client/common/models/Employee.json @@ -14,7 +14,7 @@ } }, "relations": { - "userFk": { + "user": { "type": "belongsTo", "model": "Account", "foreignKey": "userFk" diff --git a/services/client/common/models/Province.json b/services/client/common/models/Province.json index b04ecd797..777f34310 100644 --- a/services/client/common/models/Province.json +++ b/services/client/common/models/Province.json @@ -14,17 +14,17 @@ } }, "relations": { - "countryFk": { + "country": { "type": "belongsTo", "model": "Country", "foreignKey": "countryFk" }, - "warehouseFk": { + "warehouse": { "type": "belongsTo", "model": "Warehouse", "foreignKey": "warehouseFk" }, - "zoneFk": { + "zone": { "type": "belongsTo", "model": "Zone", "foreignKey": "zoneFk"