#6938 rollback phone #2417

Merged
jorgep merged 3 commits from 6938-hotfix-rollbackHidePhone into master 2024-05-07 10:44:35 +00:00
7 changed files with 119 additions and 98 deletions

View File

@ -0,0 +1,9 @@
DELETE FROM salix.ACL
WHERE model = 'Worker'
AND property = '__get__summary'
AND principalId = 'employee';
UPDATE salix.ACL SET principalId = 'employee'
WHERE model = 'Worker'
AND property IN ('find','findById','findOne')
AND principalId = 'hr';

View File

@ -2,6 +2,7 @@ import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer'; import getBrowser from '../../helpers/puppeteer';
describe('Worker summary path', () => { describe('Worker summary path', () => {
const workerId = 3;
let browser; let browser;
let page; let page;
beforeAll(async() => { beforeAll(async() => {
@ -9,7 +10,7 @@ describe('Worker summary path', () => {
page = browser.page; page = browser.page;
await page.loginAndModule('employee', 'worker'); await page.loginAndModule('employee', 'worker');
const httpDataResponse = page.waitForResponse(response => { const httpDataResponse = page.waitForResponse(response => {
return response.status() === 200 && response.url().includes(`Workers/summary`); return response.status() === 200 && response.url().includes(`Workers/${workerId}`);
}); });
await page.accessToSearchResult('agencyNick'); await page.accessToSearchResult('agencyNick');
await httpDataResponse; await httpDataResponse;

View File

@ -92,87 +92,5 @@
"model": "WorkerTeamCollegues", "model": "WorkerTeamCollegues",
"foreignKey": "workerFk" "foreignKey": "workerFk"
} }
},
"scopes":{
"summary": {
"include": [
{
"relation": "user",
"scope": {
"fields": ["email", "name", "nickname", "roleFk", "emailVerified"],
"include": [
{
"relation": "role",
"scope": {
"fields": ["name"]
}
},
{
"relation": "emailUser",
"scope": {
"fields": ["email"]
}
}
]
}
}, {
"relation": "department",
"scope": {
"include": {
"relation": "department"
}
}
}, {
"relation": "boss"
}, {
"relation": "client",
"scope": {
"fields": [
"id",
"name",
"fi",
"socialName",
"contact",
"street",
"city",
"postcode",
"email",
"mobile",
"isActive",
"credit",
"creditInsurance",
"iban",
"dueDay",
"isEqualizated",
"isFreezed",
"hasToInvoiceByAddress",
"hasToInvoice",
"isToBeMailed",
"hasSepaVnl",
"hasLcr",
"hasCoreVnl",
"hasCoreVnh",
"hasIncoterms",
"isTaxDataChecked",
"eypbc",
"quality",
"isVies",
"isRelevant",
"accountingAccount",
"created",
"sageTaxTypeFk",
"sageTransactionTypeFk",
"businessTypeFk",
"salesPersonFk",
"hasElectronicInvoice",
"rating",
"recommendedCredit"
]
}
}, {
"relation": "sip"
}
]
}
} }
} }

View File

@ -4,13 +4,37 @@ import ModuleCard from 'salix/components/module-card';
class Controller extends ModuleCard { class Controller extends ModuleCard {
reload() { reload() {
const filter = { const filter = {
where: { include: [
id: this.$params.id} {
relation: 'user',
scope: {
fields: ['name', 'emailVerified'],
include: {
relation: 'emailUser',
scope: {
fields: ['email']
}
}
}
}, {
relation: 'sip',
scope: {
fields: ['extension', 'secret']
}
}, {
relation: 'department',
scope: {
include: {
relation: 'department'
}
}
}
]
}; };
return Promise.all([ return Promise.all([
this.$http.get(`Workers/summary`, {filter}) this.$http.get(`Workers/${this.$params.id}`, {filter})
.then(res => this.worker = res.data[0]), .then(res => this.worker = res.data),
this.$http.get(`Workers/${this.$params.id}/activeContract`) this.$http.get(`Workers/${this.$params.id}/activeContract`)
.then(res => this.hasWorkCenter = res.data?.workCenterFk) .then(res => this.hasWorkCenter = res.data?.workCenterFk)
]); ]);

View File

@ -37,11 +37,41 @@ class Controller extends Descriptor {
loadData() { loadData() {
const filter = { const filter = {
where: {id: this.id}, 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/summary`, {filter}) return this.getData(`Workers/${this.id}`, {filter})
.then(res => this.entity = res.data[0]); .then(res => this.entity = res.data);
} }
getPassRequirements() { getPassRequirements() {

View File

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

View File

@ -10,14 +10,53 @@ class Controller extends Summary {
this.$.worker = null; this.$.worker = null;
if (!value) return; if (!value) return;
const query = `Workers/${value.id}`;
const filter = { const filter = {
where: { include: [
id: value.id {
} relation: 'user',
scope: {
fields: ['name', 'roleFk'],
include: [{
relation: 'role',
scope: {
fields: ['name']
}
},
{
relation: 'emailUser',
scope: {
fields: ['email']
}
}]
}
},
{
relation: 'client',
scope: {fields: ['fi', 'phone']}
},
{
relation: 'boss',
scope: {fields: ['id', 'name']}
},
{
relation: 'sip',
scope: {fields: ['extension']}
},
{
relation: 'department',
scope: {
include: {
relation: 'department',
scope: {fields: ['id', 'code', 'name']}
}
}
}
]
}; };
this.$http.get(`Workers/summary`, {filter}).then(res => { this.$http.get(query, {params: {filter}}).then(res => {
this.$.worker = res.data[0]; this.$.worker = res.data;
}); });
} }