7983-testToMaster_2438 #2977

Merged
alexm merged 212 commits from 7983-testToMaster_2438 into master 2024-09-17 05:36:47 +00:00
3 changed files with 25 additions and 41 deletions
Showing only changes of commit af1cab44eb - Show all commits

View File

@ -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"
]
}
}
]
}

View File

@ -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() {

View File

@ -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/${id}`).respond(response);
$httpBackend.expectRoute('GET', 'Workers/descriptor').respond(response);
controller.id = id;
$httpBackend.flush();
expect(controller.worker).toEqual(response);
expect(controller.worker).toEqual(response[0]);
});
});