From eb11e18df52000d1ecd45e7d6d01fa4924b6933b Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 16:01:26 +0200 Subject: [PATCH 1/4] fix: refs #7323 fetch from right source --- modules/worker/front/descriptor/index.js | 38 ++---------------------- 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/modules/worker/front/descriptor/index.js b/modules/worker/front/descriptor/index.js index 75265acb4..4860163c1 100644 --- a/modules/worker/front/descriptor/index.js +++ b/modules/worker/front/descriptor/index.js @@ -36,42 +36,8 @@ class Controller extends Descriptor { } loadData() { - const filter = { - include: [ - { - relation: 'user', - scope: { - fields: ['name', 'emailVerified'], - include: { - relation: 'emailUser', - scope: { - fields: ['email'] - } - } - } - }, { - relation: 'client', - scope: { - fields: ['fi'] - } - }, { - relation: 'sip', - scope: { - fields: ['extension'] - } - }, { - relation: 'department', - scope: { - include: { - relation: 'department' - } - } - } - ] - }; - - return this.getData(`Workers/${this.id}`, {filter}) - .then(res => this.entity = res.data); + return this.getData('Workers/descriptor', {filter: {where: {id: this.id}}}) + .then(res => this.entity = res.data[0]); } getPassRequirements() { From 6065c056e20da91f3f8984f8159cf0d15a2e29fc Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 16:04:40 +0200 Subject: [PATCH 2/4] chore: refs #7323 fix test --- modules/worker/front/descriptor/index.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/worker/front/descriptor/index.spec.js b/modules/worker/front/descriptor/index.spec.js index 4f7fa6a05..e7eec86d3 100644 --- a/modules/worker/front/descriptor/index.spec.js +++ b/modules/worker/front/descriptor/index.spec.js @@ -17,7 +17,7 @@ describe('vnWorkerDescriptor', () => { const response = 'foo'; $httpBackend.whenGET('UserConfigs/getUserConfig').respond({}); - $httpBackend.expectRoute('GET', `Workers/${id}`).respond(response); + $httpBackend.expectRoute('GET', 'Workers/descriptor').respond(response); controller.id = id; $httpBackend.flush(); From 0a4bd0f2d51f4950b46b67e2fd54ab0d120a825e Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 16:09:29 +0200 Subject: [PATCH 3/4] chore: refs #7323 fix test --- modules/worker/front/descriptor/index.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/worker/front/descriptor/index.spec.js b/modules/worker/front/descriptor/index.spec.js index e7eec86d3..8797c8b4a 100644 --- a/modules/worker/front/descriptor/index.spec.js +++ b/modules/worker/front/descriptor/index.spec.js @@ -14,14 +14,14 @@ describe('vnWorkerDescriptor', () => { describe('loadData()', () => { it(`should perform a get query to store the worker data into the controller`, () => { const id = 1; - const response = 'foo'; + const response = ['foo']; $httpBackend.whenGET('UserConfigs/getUserConfig').respond({}); $httpBackend.expectRoute('GET', 'Workers/descriptor').respond(response); controller.id = id; $httpBackend.flush(); - expect(controller.worker).toEqual(response); + expect(controller.worker).toEqual(response[0]); }); }); From ba2c5cb209c999baa11d0aa57024900c27f1515e Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 6 Sep 2024 17:49:45 +0200 Subject: [PATCH 4/4] chore: refs #7323 filter data --- modules/worker/back/models/worker.json | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index b809768a4..82cd1cc2d 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -143,6 +143,10 @@ ], "scopes": { "descriptor": { + "fields": [ + "id", + "phone" + ], "include": [ { "relation": "user", @@ -164,15 +168,29 @@ { "relation": "department", "scope": { + "fields": [ + "departmentFk" + ], "include": [ { - "relation": "department" + "relation": "department", + "scope": { + "fields": [ + "id", + "name" + ] + } } ] } }, { - "relation": "sip" + "relation": "sip", + "scope": { + "fields": [ + "extension" + ] + } } ] }