Merge pull request 'fix: refs #7323 fetch from right source' (!2933) from 7323-replaceWorkerDataSource into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #2933 Reviewed-by: Javi Gallego <jgallego@verdnatura.es>
This commit is contained in:
commit
af1cab44eb
|
@ -143,6 +143,10 @@
|
||||||
],
|
],
|
||||||
"scopes": {
|
"scopes": {
|
||||||
"descriptor": {
|
"descriptor": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"phone"
|
||||||
|
],
|
||||||
"include": [
|
"include": [
|
||||||
{
|
{
|
||||||
"relation": "user",
|
"relation": "user",
|
||||||
|
@ -164,15 +168,29 @@
|
||||||
{
|
{
|
||||||
"relation": "department",
|
"relation": "department",
|
||||||
"scope": {
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"departmentFk"
|
||||||
|
],
|
||||||
"include": [
|
"include": [
|
||||||
{
|
{
|
||||||
"relation": "department"
|
"relation": "department",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"id",
|
||||||
|
"name"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"relation": "sip"
|
"relation": "sip",
|
||||||
|
"scope": {
|
||||||
|
"fields": [
|
||||||
|
"extension"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,42 +36,8 @@ class Controller extends Descriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadData() {
|
loadData() {
|
||||||
const filter = {
|
return this.getData('Workers/descriptor', {filter: {where: {id: this.id}}})
|
||||||
include: [
|
.then(res => this.entity = res.data[0]);
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getPassRequirements() {
|
getPassRequirements() {
|
||||||
|
|
|
@ -14,14 +14,14 @@ describe('vnWorkerDescriptor', () => {
|
||||||
describe('loadData()', () => {
|
describe('loadData()', () => {
|
||||||
it(`should perform a get query to store the worker data into the controller`, () => {
|
it(`should perform a get query to store the worker data into the controller`, () => {
|
||||||
const id = 1;
|
const id = 1;
|
||||||
const response = 'foo';
|
const response = ['foo'];
|
||||||
|
|
||||||
$httpBackend.whenGET('UserConfigs/getUserConfig').respond({});
|
$httpBackend.whenGET('UserConfigs/getUserConfig').respond({});
|
||||||
$httpBackend.expectRoute('GET', `Workers/${id}`).respond(response);
|
$httpBackend.expectRoute('GET', 'Workers/descriptor').respond(response);
|
||||||
controller.id = id;
|
controller.id = id;
|
||||||
$httpBackend.flush();
|
$httpBackend.flush();
|
||||||
|
|
||||||
expect(controller.worker).toEqual(response);
|
expect(controller.worker).toEqual(response[0]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue