This commit is contained in:
Joan Sanchez 2019-01-31 09:48:11 +01:00
commit e74b7e3118
9 changed files with 25 additions and 46 deletions

View File

@ -7,7 +7,7 @@ describe('Client activeWorkersWithRole', () => {
let isSalesPerson = await app.models.Account.hasRole(result[0].id, 'salesPerson'); let isSalesPerson = await app.models.Account.hasRole(result[0].id, 'salesPerson');
expect(result.length).toEqual(10); expect(result.length).toEqual(11);
expect(isSalesPerson).toBeTruthy(); expect(isSalesPerson).toBeTruthy();
}); });

View File

@ -6,7 +6,7 @@ describe('Client listWorkers', () => {
.then(result => { .then(result => {
let amountOfEmployees = Object.keys(result).length; let amountOfEmployees = Object.keys(result).length;
expect(amountOfEmployees).toEqual(43); expect(amountOfEmployees).toEqual(44);
done(); done();
}) })
.catch(done.fail); .catch(done.fail);

View File

@ -1,7 +1,7 @@
const app = require('vn-loopback/server/server'); const app = require('vn-loopback/server/server');
describe('item getLastEntries()', () => { describe('item getLastEntries()', () => {
it('should return one entry for a given item', async () => { it('should return one entry for a given item', async() => {
let date = new Date(); let date = new Date();
let filter = {where: {itemFk: 1, date: date}}; let filter = {where: {itemFk: 1, date: date}};
let result = await app.models.Item.getLastEntries(filter); let result = await app.models.Item.getLastEntries(filter);
@ -9,9 +9,10 @@ describe('item getLastEntries()', () => {
expect(result.length).toEqual(1); expect(result.length).toEqual(1);
}); });
it('should return three entries for a given item', async () => { it('should return three entries for a given item', async() => {
let date = new Date(); let date = new Date();
date.setMonth(date.getMonth() - 2);
date.setMonth(date.getMonth() - 2, 15);
let filter = {where: {itemFk: 1, date: date}}; let filter = {where: {itemFk: 1, date: date}};
let result = await app.models.Item.getLastEntries(filter); let result = await app.models.Item.getLastEntries(filter);

View File

@ -3,7 +3,7 @@
"base": "VnModel", "base": "VnModel",
"options": { "options": {
"mysql": { "mysql": {
"table": "personDepartment" "table": "workerDepartment"
} }
}, },
"properties": { "properties": {

View File

@ -3,7 +3,7 @@
"base": "VnModel", "base": "VnModel",
"options": { "options": {
"mysql": { "mysql": {
"table": "personMedia" "table": "workerMedia"
} }
}, },
"properties": { "properties": {

View File

@ -3,7 +3,7 @@ CREATE
OR REPLACE ALGORITHM = UNDEFINED OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%` DEFINER = `root`@`%`
SQL SECURITY DEFINER SQL SECURITY DEFINER
VIEW `personMedia` AS VIEW `workerMedia` AS
SELECT SELECT
`p`.`id_trabajador` AS `workerFk`, `p`.`id_trabajador` AS `workerFk`,
`m`.`value` AS `mediaValue` `m`.`value` AS `mediaValue`

View File

@ -3,12 +3,10 @@ CREATE
OR REPLACE ALGORITHM = UNDEFINED OR REPLACE ALGORITHM = UNDEFINED
DEFINER = `root`@`%` DEFINER = `root`@`%`
SQL SECURITY DEFINER SQL SECURITY DEFINER
VIEW `vn`.`personDepartment` AS VIEW `vn`.`workerDepartment` AS
SELECT SELECT
`p`.`id_trabajador` AS `workerFk`, `p`.`id_trabajador` AS `workerFk`,
`p`.`name` AS `name`, `d`.`name` AS `departmentFk`
`p`.`firstname` AS `firstname`,
`d`.`name` AS `department`
FROM FROM
(((`postgresql`.`person` `p` (((`postgresql`.`person` `p`
JOIN `postgresql`.`profile` `pr` ON ((`pr`.`person_id` = `p`.`person_id`))) JOIN `postgresql`.`profile` `pr` ON ((`pr`.`person_id` = `p`.`person_id`)))

View File

@ -1,20 +0,0 @@
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Zone','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('ZoneGeo','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('ZoneCalendar','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('ZoneIncluded','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('LabourHoliday','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('LabourHolidayLegend','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('LabourHolidayType','*','READ','ALLOW','ROLE','employee');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('Zone','*','WRITE','ALLOW','ROLE','deliveryBoss');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('ZoneCalendar','*','WRITE','ALLOW','ROLE','deliveryBoss');
INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId)
VALUES ('ZoneIncluded','*','WRITE','ALLOW','ROLE','deliveryBoss');

File diff suppressed because one or more lines are too long