1880-refactor_loggable #337

Merged
joan merged 7 commits from 1880-refactor_loggable into dev 2020-07-16 12:12:19 +00:00
5 changed files with 17 additions and 8 deletions

View File

@ -1,5 +0,0 @@
UPDATE `salix`.`ACL` SET `accessType`='WRITE' WHERE `id`='213';
UPDATE `salix`.`ACL` SET `property` = 'deleteSales' WHERE (`id` = '80');
INSERT IGNORE INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`) VALUES ('CustomsAgent', '*', '*', 'ALLOW', 'ROLE', 'employee');

View File

@ -211,12 +211,16 @@ describe('Ticket Edit sale path', () => {
it('should search for a ticket then access to the sales section', async() => { it('should search for a ticket then access to the sales section', async() => {
await page.accessToSearchResult('16'); await page.accessToSearchResult('16');
await page.accessToSection('ticket.card.sale'); await page.accessToSection('ticket.card.sale');
await page.wait(2000);
}); });
it('should select the third sale and delete it', async() => { it('should select the third sale and delete it', async() => {
await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox); await page.waitToClick(selectors.ticketSales.thirdSaleCheckbox);
await page.wait(2000);
await page.waitToClick(selectors.ticketSales.deleteSaleButton); await page.waitToClick(selectors.ticketSales.deleteSaleButton);
await page.wait(2000);
await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton); await page.waitToClick(selectors.ticketSales.acceptDeleteLineButton);
await page.wait(2000);
await page.waitForSpinnerLoad(); await page.waitForSpinnerLoad();
const message = await page.waitForSnackbar(); const message = await page.waitForSnackbar();

View File

@ -249,7 +249,6 @@ module.exports = function(Self) {
let newInstance = {}; let newInstance = {};
if (ctx.hookState.newInstance) if (ctx.hookState.newInstance)
Object.assign(newInstance, ctx.hookState.newInstance); Object.assign(newInstance, ctx.hookState.newInstance);
let userFk; let userFk;
if (loopBackContext) if (loopBackContext)
userFk = loopBackContext.active.accessToken.userId; userFk = loopBackContext.active.accessToken.userId;

View File

@ -27,11 +27,11 @@ module.exports = function(Self) {
{ {
relation: 'salesPerson', relation: 'salesPerson',
scope: { scope: {
fields: ['userFk'], fields: ['userFk', 'firstName'],
include: { include: {
relation: 'user', relation: 'user',
scope: { scope: {
fields: ['nickname'] fields: ['name', 'nickname']
} }
} }
} }
@ -45,6 +45,12 @@ module.exports = function(Self) {
scope: { scope: {
fields: ['id', 'name'] fields: ['id', 'name']
} }
}, {
}, {
relation: 'salesPersonUser',
scope: {
fields: ['id', 'name']
}
}, { }, {
relation: 'country', relation: 'country',
scope: { scope: {

View File

@ -136,6 +136,11 @@
"model": "Worker", "model": "Worker",
"foreignKey": "salesPersonFk" "foreignKey": "salesPersonFk"
}, },
"salesPersonUser": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "salesPersonFk"
},
"province": { "province": {
"type": "belongsTo", "type": "belongsTo",
"model": "Province", "model": "Province",