Merge branch 'dev' into 4550-printServer
This commit is contained in:
commit
af6acbd066
|
@ -13,7 +13,7 @@ RUN apt-get update \
|
|||
libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 \
|
||||
libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \
|
||||
libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget \
|
||||
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
|
||||
&& curl -sL https://deb.nodesource.com/setup_14.x | bash - \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
nodejs \
|
||||
&& apt-get purge -y --auto-remove \
|
||||
|
|
|
@ -62,13 +62,13 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
stage('Backend') {
|
||||
steps {
|
||||
nodejs('node-v14') {
|
||||
sh 'npm run test:back:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
// stage('Backend') {
|
||||
// steps {
|
||||
// nodejs('node-v14') {
|
||||
// sh 'npm run test:back:ci'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
|
|
|
@ -29,6 +29,8 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.privileges = async function(ctx, id, roleFk, hasGrant, options) {
|
||||
if (!(hasGrant != null || roleFk)) return;
|
||||
|
||||
const models = Self.app.models;
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
|
||||
|
@ -37,22 +39,40 @@ module.exports = Self => {
|
|||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const user = await models.Account.findById(userId, null, myOptions);
|
||||
const user = await models.Account.findById(userId, {fields: ['hasGrant']}, myOptions);
|
||||
|
||||
const userToUpdate = await models.Account.findById(id, {
|
||||
fields: ['id', 'name', 'hasGrant', 'roleFk', 'password'],
|
||||
include: {
|
||||
relation: 'role',
|
||||
scope: {
|
||||
fields: ['name']
|
||||
}
|
||||
}
|
||||
}, myOptions);
|
||||
|
||||
if (!user.hasGrant)
|
||||
throw new UserError(`You don't have enough privileges`);
|
||||
throw new UserError(`You don't have grant privilege`);
|
||||
|
||||
const hasRoleFromUser = await models.Account.hasRole(userId, userToUpdate.role().name, myOptions);
|
||||
|
||||
if (!hasRoleFromUser)
|
||||
throw new UserError(`You don't own the role and you can't assign it to another user`);
|
||||
|
||||
const userToUpdate = await models.Account.findById(id);
|
||||
if (hasGrant != null)
|
||||
return await userToUpdate.updateAttribute('hasGrant', hasGrant, myOptions);
|
||||
if (!roleFk) return;
|
||||
userToUpdate.hasGrant = hasGrant;
|
||||
|
||||
const role = await models.Role.findById(roleFk, null, myOptions);
|
||||
if (roleFk) {
|
||||
const role = await models.Role.findById(roleFk, {fields: ['name']}, myOptions);
|
||||
const hasRole = await models.Account.hasRole(userId, role.name, myOptions);
|
||||
|
||||
if (!hasRole)
|
||||
throw new UserError(`You don't have enough privileges`);
|
||||
throw new UserError(`You don't own the role and you can't assign it to another user`);
|
||||
|
||||
await userToUpdate.updateAttribute('roleFk', roleFk, myOptions);
|
||||
userToUpdate.roleFk = roleFk;
|
||||
}
|
||||
|
||||
await userToUpdate.save(userToUpdate);
|
||||
await models.UserAccount.sync(userToUpdate.name);
|
||||
};
|
||||
};
|
||||
|
|
|
@ -4,7 +4,9 @@ describe('account privileges()', () => {
|
|||
const employeeId = 1;
|
||||
const developerId = 9;
|
||||
const sysadminId = 66;
|
||||
const bruceWayneId = 1101;
|
||||
const itBossId = 104;
|
||||
const rootId = 100;
|
||||
const clarkKent = 1103;
|
||||
|
||||
it('should throw an error when user not has privileges', async() => {
|
||||
const ctx = {req: {accessToken: {userId: developerId}}};
|
||||
|
@ -22,7 +24,7 @@ describe('account privileges()', () => {
|
|||
await tx.rollback();
|
||||
}
|
||||
|
||||
expect(error.message).toContain(`You don't have enough privileges`);
|
||||
expect(error.message).toContain(`You don't have grant privilege`);
|
||||
});
|
||||
|
||||
it('should throw an error when user has privileges but not has the role', async() => {
|
||||
|
@ -33,12 +35,7 @@ describe('account privileges()', () => {
|
|||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const root = await models.Role.findOne({
|
||||
where: {
|
||||
name: 'root'
|
||||
}
|
||||
}, options);
|
||||
await models.Account.privileges(ctx, employeeId, root.id, null, options);
|
||||
await models.Account.privileges(ctx, employeeId, rootId, null, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -46,7 +43,26 @@ describe('account privileges()', () => {
|
|||
await tx.rollback();
|
||||
}
|
||||
|
||||
expect(error.message).toContain(`You don't have enough privileges`);
|
||||
expect(error.message).toContain(`You don't own the role and you can't assign it to another user`);
|
||||
});
|
||||
|
||||
it('should throw an error when user has privileges but not has the role from user', async() => {
|
||||
const ctx = {req: {accessToken: {userId: sysadminId}}};
|
||||
const tx = await models.Account.beginTransaction({});
|
||||
|
||||
let error;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
await models.Account.privileges(ctx, itBossId, developerId, null, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
error = e;
|
||||
await tx.rollback();
|
||||
}
|
||||
|
||||
expect(error.message).toContain(`You don't own the role and you can't assign it to another user`);
|
||||
});
|
||||
|
||||
it('should change role', async() => {
|
||||
|
@ -63,8 +79,8 @@ describe('account privileges()', () => {
|
|||
let error;
|
||||
let result;
|
||||
try {
|
||||
await models.Account.privileges(ctx, bruceWayneId, agency.id, null, options);
|
||||
result = await models.Account.findById(bruceWayneId, null, options);
|
||||
await models.Account.privileges(ctx, clarkKent, agency.id, null, options);
|
||||
result = await models.Account.findById(clarkKent, null, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
@ -84,8 +100,8 @@ describe('account privileges()', () => {
|
|||
let result;
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
await models.Account.privileges(ctx, bruceWayneId, null, true, options);
|
||||
result = await models.Account.findById(bruceWayneId, null, options);
|
||||
await models.Account.privileges(ctx, clarkKent, null, true, options);
|
||||
result = await models.Account.findById(clarkKent, null, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
|
|
|
@ -17,18 +17,11 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
Self.deleteTrashFiles = async options => {
|
||||
let tx;
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
if (process.env.NODE_ENV == 'test')
|
||||
throw new UserError(`Action not allowed on the test environment`);
|
||||
|
||||
|
@ -63,15 +56,11 @@ module.exports = Self => {
|
|||
const dstFolder = path.join(dmsContainer.client.root, pathHash);
|
||||
try {
|
||||
await fs.rmdir(dstFolder);
|
||||
} catch (err) {}
|
||||
} catch (err) {
|
||||
continue;
|
||||
}
|
||||
|
||||
await dms.destroy(myOptions);
|
||||
}
|
||||
if (tx) await tx.commit();
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('clean', {
|
||||
description: 'clean notifications from queue',
|
||||
accessType: 'WRITE',
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/clean`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.clean = async options => {
|
||||
const models = Self.app.models;
|
||||
const status = ['sent', 'error'];
|
||||
|
||||
const myOptions = {};
|
||||
let tx;
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
const config = await models.NotificationConfig.findOne({}, myOptions);
|
||||
const cleanDate = new Date();
|
||||
cleanDate.setDate(cleanDate.getDate() - config.cleanDays);
|
||||
|
||||
await models.NotificationQueue.destroyAll({
|
||||
where: {status: {inq: status}},
|
||||
created: {lt: cleanDate}
|
||||
}, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -0,0 +1,81 @@
|
|||
const {Email} = require('vn-print');
|
||||
const UserError = require('vn-loopback/util/user-error');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('send', {
|
||||
description: 'Send notifications from queue',
|
||||
accessType: 'WRITE',
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/send`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.send = async options => {
|
||||
const models = Self.app.models;
|
||||
const findStatus = 'pending';
|
||||
|
||||
const myOptions = {};
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const notificationQueue = await models.NotificationQueue.find({
|
||||
where: {status: findStatus},
|
||||
include: [
|
||||
{
|
||||
relation: 'notification',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'subscription',
|
||||
scope: {
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['name', 'email', 'lang']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
]
|
||||
}, myOptions);
|
||||
|
||||
const statusSent = 'sent';
|
||||
const statusError = 'error';
|
||||
|
||||
for (const queue of notificationQueue) {
|
||||
const queueName = queue.notification().name;
|
||||
const queueParams = JSON.parse(queue.params);
|
||||
|
||||
for (const notificationUser of queue.notification().subscription()) {
|
||||
try {
|
||||
const sendParams = {
|
||||
recipient: notificationUser.user().email,
|
||||
lang: notificationUser.user().lang
|
||||
};
|
||||
|
||||
if (notificationUser.userFk == queue.authorFk) {
|
||||
await queue.updateAttribute('status', statusSent);
|
||||
continue;
|
||||
}
|
||||
|
||||
const newParams = Object.assign({}, queueParams, sendParams);
|
||||
const email = new Email(queueName, newParams);
|
||||
|
||||
if (process.env.NODE_ENV != 'test')
|
||||
await email.send();
|
||||
|
||||
await queue.updateAttribute('status', statusSent);
|
||||
} catch (error) {
|
||||
await queue.updateAttribute('status', statusError);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -0,0 +1,42 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('Notification Clean()', () => {
|
||||
it('should delete old rows with error', async() => {
|
||||
const userId = 9;
|
||||
const status = 'error';
|
||||
const tx = await models.NotificationQueue.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
|
||||
const notification = await models.Notification.findOne({}, options);
|
||||
const notificationConfig = await models.NotificationConfig.findOne({});
|
||||
|
||||
const cleanDate = new Date();
|
||||
cleanDate.setDate(cleanDate.getDate() - (notificationConfig.cleanDays + 1));
|
||||
|
||||
let before;
|
||||
let after;
|
||||
|
||||
try {
|
||||
const notificationDelete = await models.NotificationQueue.create({
|
||||
notificationFk: notification.name,
|
||||
authorFk: userId,
|
||||
status: status,
|
||||
created: cleanDate
|
||||
}, options);
|
||||
|
||||
before = await models.NotificationQueue.findById(notificationDelete.id, null, options);
|
||||
|
||||
await models.Notification.clean(options);
|
||||
|
||||
after = await models.NotificationQueue.findById(notificationDelete.id, null, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
|
||||
expect(before.notificationFk).toEqual(notification.name);
|
||||
expect(after).toBe(null);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,33 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
describe('Notification Send()', () => {
|
||||
it('should send notification', async() => {
|
||||
const statusPending = 'pending';
|
||||
const tx = await models.NotificationQueue.beginTransaction({});
|
||||
const options = {transaction: tx};
|
||||
const filter = {
|
||||
where: {
|
||||
status: statusPending
|
||||
}
|
||||
};
|
||||
|
||||
let before;
|
||||
let after;
|
||||
|
||||
try {
|
||||
before = await models.NotificationQueue.find(filter, options);
|
||||
|
||||
await models.Notification.send(options);
|
||||
|
||||
after = await models.NotificationQueue.find(filter, options);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
|
||||
expect(before.length).toEqual(3);
|
||||
expect(after.length).toEqual(0);
|
||||
});
|
||||
});
|
|
@ -77,6 +77,21 @@
|
|||
"Module": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Notification": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"NotificationAcl": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"NotificationConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"NotificationQueue": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"NotificationSubscription": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Province": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
@ -101,6 +116,9 @@
|
|||
"Town": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Url": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"UserConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -102,6 +102,13 @@
|
|||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
},
|
||||
{
|
||||
"property": "privileges",
|
||||
"accessType": "*",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$authenticated",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/notification/send')(Self);
|
||||
require('../methods/notification/clean')(Self);
|
||||
};
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "Notification",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "util.notification"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"description": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"subscription": {
|
||||
"type": "hasMany",
|
||||
"model": "NotificationSubscription",
|
||||
"foreignKey": "notificationFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "NotificationAcl",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "util.notificationAcl"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"notification": {
|
||||
"type": "belongsTo",
|
||||
"model": "Notification",
|
||||
"foreignKey": "notificationFk"
|
||||
},
|
||||
"role": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"foreignKey": "roleFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "NotificationConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "util.notificationConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"cleanDays": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"name": "NotificationQueue",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "util.notificationQueue"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"params": {
|
||||
"type": "string"
|
||||
},
|
||||
"status": {
|
||||
"type": "string"
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"notification": {
|
||||
"type": "belongsTo",
|
||||
"model": "Notification",
|
||||
"foreignKey": "notificationFk",
|
||||
"primaryKey": "name"
|
||||
},
|
||||
"author": {
|
||||
"type": "belongsTo",
|
||||
"model": "Account",
|
||||
"foreignKey": "authorFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "NotificationSubscription",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "util.notificationSubscription"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"notificationFk": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"userFk": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"notification": {
|
||||
"type": "belongsTo",
|
||||
"model": "Notification",
|
||||
"foreignKey": "notificationFk"
|
||||
},
|
||||
"user": {
|
||||
"type": "belongsTo",
|
||||
"model": "Account",
|
||||
"foreignKey": "userFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"name": "Url",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "salix.url"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"appName": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"id": 1
|
||||
},
|
||||
"environment": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"id": 2
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Receipt', 'receiptPdf', '*', 'ALLOW', 'ROLE', 'salesAssistant');
|
|
@ -0,0 +1,12 @@
|
|||
CREATE TABLE `vn`.`packingSiteConfig` (
|
||||
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`shinobiUrl` varchar(255) NOT NULL,
|
||||
`shinobiToken` varchar(255) NOT NULL,
|
||||
`shinobiGroupKey` varchar(255) NOT NULL,
|
||||
`avgBoxingTime` INT(3) NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Boxing', '*', '*', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,56 @@
|
|||
ALTER TABLE `vn`.`packingSite` ADD monitorId varchar(255) NULL;
|
||||
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'VbiUcajdaT'
|
||||
WHERE code = 'h1';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'qKMPn9aaVe'
|
||||
WHERE code = 'h2';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = '3CtdIAGPAv'
|
||||
WHERE code = 'h3';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'Xme2hiqz1f'
|
||||
WHERE code = 'h4';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'aulxefgfJU'
|
||||
WHERE code = 'h5';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = '6Ou0D1bhBw'
|
||||
WHERE code = 'h6';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'eVUvnE6pNw'
|
||||
WHERE code = 'h7';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = '0wsmSvqmrs'
|
||||
WHERE code = 'h8';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'r2l2RyyF4I'
|
||||
WHERE code = 'h9';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'EdjHLIiDVD'
|
||||
WHERE code = 'h10';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'czC45kmwqI'
|
||||
WHERE code = 'h11';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'PNsmxPaCwQ'
|
||||
WHERE code = 'h12';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'agVssO0FDC'
|
||||
WHERE code = 'h13';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'f2SPNENHPo'
|
||||
WHERE code = 'h14';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = '6UR7gUZxks'
|
||||
WHERE code = 'h15';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'bOB0f8WZ2V'
|
||||
WHERE code = 'h16';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = 'MIR1nXaL0n'
|
||||
WHERE code = 'h17';
|
||||
UPDATE `vn`.`packingSite`
|
||||
SET monitorId = '0Oj9SgGTXR'
|
||||
WHERE code = 'h18';
|
|
@ -0,0 +1,33 @@
|
|||
CREATE TABLE `salix`.`url` (
|
||||
`appName` varchar(100) NOT NULL,
|
||||
`environment` varchar(100) NOT NULL,
|
||||
`url` varchar(255) NOT NULL,
|
||||
PRIMARY KEY (`appName`,`environment`)
|
||||
);
|
||||
|
||||
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||
VALUES
|
||||
('salix', 'production', 'https://salix.verdnatura.es/#!/');
|
||||
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||
VALUES
|
||||
('salix', 'test', 'https://test-salix.verdnatura.es/#!/');
|
||||
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||
VALUES
|
||||
('salix', 'dev', 'http://localhost:5000/#!/');
|
||||
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||
VALUES
|
||||
('lilium', 'production', 'https://lilium.verdnatura.es/#/');
|
||||
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||
VALUES
|
||||
('lilium', 'test', 'https://test-lilium.verdnatura.es/#/');
|
||||
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||
VALUES
|
||||
('lilium', 'dev', 'http://localhost:8080/#/');
|
||||
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Url', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Url', '*', 'WRITE', 'ALLOW', 'ROLE', 'it');
|
|
@ -0,0 +1,3 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('Notification', '*', 'WRITE', 'ALLOW', 'ROLE', 'developer');
|
|
@ -0,0 +1,2 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalId)
|
||||
VALUES ('WorkerDisableExcluded','*','*','ALLOW','hr');
|
|
@ -0,0 +1,2 @@
|
|||
INSERT INTO `vn`.`payDem` (id,payDem)
|
||||
VALUES (7,'0');
|
|
@ -0,0 +1,2 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,principalId)
|
||||
VALUES ('Supplier','newSupplier','WRITE','administrative');
|
|
@ -0,0 +1,28 @@
|
|||
DROP FUNCTION IF EXISTS `util`.`notification_send`;
|
||||
DELIMITER $$
|
||||
CREATE DEFINER=`root`@`localhost` FUNCTION `util`.`notification_send`(vNotificationName VARCHAR(255), vParams TEXT, vAuthorFk INT)
|
||||
RETURNS INT
|
||||
MODIFIES SQL DATA
|
||||
BEGIN
|
||||
/**
|
||||
* Sends a notification.
|
||||
*
|
||||
* @param vNotificationName The notification name
|
||||
* @param vParams The notification parameters formatted as JSON
|
||||
* @param vAuthorFk The notification author or %NULL if there is no author
|
||||
* @return The notification id
|
||||
*/
|
||||
DECLARE vNotificationFk INT;
|
||||
|
||||
SELECT id INTO vNotificationFk
|
||||
FROM `notification`
|
||||
WHERE `name` = vNotificationName;
|
||||
|
||||
INSERT INTO notificationQueue
|
||||
SET notificationFk = vNotificationFk,
|
||||
params = vParams,
|
||||
authorFk = vAuthorFk;
|
||||
|
||||
RETURN LAST_INSERT_ID();
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,63 @@
|
|||
USE util;
|
||||
|
||||
CREATE TABLE notification(
|
||||
id INT PRIMARY KEY,
|
||||
`name` VARCHAR(255) UNIQUE,
|
||||
`description` VARCHAR(255)
|
||||
);
|
||||
|
||||
CREATE TABLE notificationAcl(
|
||||
notificationFk INT,
|
||||
roleFk INT(10) unsigned,
|
||||
PRIMARY KEY(notificationFk, roleFk)
|
||||
);
|
||||
|
||||
ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `util`.`notificationAcl` ADD CONSTRAINT `notificationAcl_ibfk_2` FOREIGN KEY (`roleFk`) REFERENCES `account`.`role`(`id`)
|
||||
ON DELETE RESTRICT
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
CREATE TABLE notificationSubscription(
|
||||
notificationFk INT,
|
||||
userFk INT(10) unsigned,
|
||||
PRIMARY KEY(notificationFk, userFk)
|
||||
);
|
||||
|
||||
ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `util`.`notificationSubscription` ADD CONSTRAINT `notificationSubscription_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user`(`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
CREATE TABLE notificationQueue(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
notificationFk VARCHAR(255),
|
||||
params JSON,
|
||||
authorFk INT(10) unsigned NULL,
|
||||
`status` ENUM('pending', 'sent', 'error') NOT NULL DEFAULT 'pending',
|
||||
created DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
INDEX(notificationFk),
|
||||
INDEX(authorFk),
|
||||
INDEX(status)
|
||||
);
|
||||
|
||||
ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `nnotificationQueue_ibfk_1` FOREIGN KEY (`notificationFk`) REFERENCES `util`.`notification` (`name`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `util`.`notificationQueue` ADD CONSTRAINT `notificationQueue_ibfk_2` FOREIGN KEY (`authorFk`) REFERENCES `account`.`user`(`id`)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
CREATE TABLE notificationConfig(
|
||||
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||
cleanDays MEDIUMINT
|
||||
);
|
||||
|
||||
INSERT INTO notificationConfig
|
||||
SET cleanDays = 90;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `vn`.`supplier` MODIFY COLUMN payMethodFk tinyint(3) unsigned NULL;
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `vn`.`supplier` MODIFY COLUMN supplierActivityFk varchar(45) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL NULL;
|
|
@ -0,0 +1,35 @@
|
|||
drop procedure `vn`.`ticket_closeByTicket`;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
create
|
||||
definer = `root`@`localhost` procedure `vn`.`ticket_closeByTicket`(IN vTicketFk int)
|
||||
BEGIN
|
||||
|
||||
/**
|
||||
* Inserta el ticket en la tabla temporal
|
||||
* para ser cerrado.
|
||||
*
|
||||
* @param vTicketFk Id del ticket
|
||||
*/
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.ticket_close;
|
||||
CREATE TEMPORARY TABLE tmp.ticket_close ENGINE = MEMORY (
|
||||
SELECT
|
||||
t.id AS ticketFk
|
||||
FROM ticket t
|
||||
JOIN agencyMode am ON am.id = t.agencyModeFk
|
||||
LEFT JOIN ticketState ts ON ts.ticketFk = t.id
|
||||
JOIN alertLevel al ON al.id = ts.alertLevel
|
||||
WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')
|
||||
AND t.id = vTicketFk
|
||||
AND t.refFk IS NULL
|
||||
GROUP BY t.id);
|
||||
|
||||
CALL ticket_close();
|
||||
|
||||
DROP TEMPORARY TABLE tmp.ticket_close;
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
INSERT INTO `salix`.`ACL` (model, property, accessType, permission, principalType, principalId)
|
||||
VALUES
|
||||
('ClaimRma', '*', 'READ', 'ALLOW', 'ROLE', 'claimManager'),
|
||||
('ClaimRma', '*', 'WRITE', 'ALLOW', 'ROLE', 'claimManager');
|
||||
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE `vn`.`claim` ADD rma varchar(100) NULL ;
|
|
@ -0,0 +1,7 @@
|
|||
CREATE TABLE `vn`.`claimRma` (
|
||||
id INT UNSIGNED auto_increment NOT NULL PRIMARY KEY,
|
||||
code varchar(100) NOT NULL,
|
||||
created timestamp DEFAULT current_timestamp() NOT NULL,
|
||||
workerFk INTEGER UNSIGNED NOT NULL
|
||||
)
|
||||
ENGINE=InnoDB;
|
|
@ -45,8 +45,8 @@ INSERT INTO `account`.`roleConfig`(`id`, `mysqlPassword`, `rolePrefix`, `userPre
|
|||
|
||||
CALL `account`.`role_sync`;
|
||||
|
||||
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`, `image`)
|
||||
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'en', '4fa3ada0-3ac4-11eb-9ab8-27f6fc3b85fd'
|
||||
INSERT INTO `account`.`user`(`id`,`name`, `nickname`, `password`,`role`,`active`,`email`, `lang`, `image`, `bcryptPassword`)
|
||||
SELECT id, name, CONCAT(name, 'Nick'),MD5('nightmare'), id, 1, CONCAT(name, '@mydomain.com'), 'en', '4fa3ada0-3ac4-11eb-9ab8-27f6fc3b85fd', '$2b$10$UzQHth.9UUQ1T5aiQJ21lOU0oVlbxoqH4PFM9V8T90KNSAcg0eEL2'
|
||||
FROM `account`.`role` WHERE id <> 20
|
||||
ORDER BY id;
|
||||
|
||||
|
@ -918,21 +918,21 @@ INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
|
|||
(3, 'Perdida', 'LOST');
|
||||
|
||||
|
||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
|
||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`, `hostFk`)
|
||||
VALUES
|
||||
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1),
|
||||
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1),
|
||||
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2),
|
||||
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2),
|
||||
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3),
|
||||
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3),
|
||||
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL),
|
||||
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1),
|
||||
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2),
|
||||
(10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3),
|
||||
(11, 7, 8, 71, NOW(), NULL, 1, 18, NULL, 94, 3),
|
||||
(12, 7, 9, 71, NOW(), NULL, 1, 18, NULL, 94, 3),
|
||||
(13, 1, 10, 71, NOW(), NULL, 1, 18, NULL, 94, 3);
|
||||
(1, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 15, 1, 18, 'UR9000006041', 94, 1, 'pc1'),
|
||||
(2, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 16, 2, 18, 'UR9000006041', 94, 1, NULL),
|
||||
(3, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 3, 18, 'UR9000006041', 94, 2, NULL),
|
||||
(4, 1, 1, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 4, 18, 'UR9000006041', 94, 2, NULL),
|
||||
(5, 1, 2, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||
(6, 7, 3, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -2 MONTH), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||
(7, 2, 4, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -3 MONTH), NULL, 1, 18, NULL, 94, NULL,NULL),
|
||||
(8, 3, 5, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -4 MONTH), NULL, 1, 18, NULL, 94, 1, NULL),
|
||||
(9, 3, 6, 71, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), NULL, 1, 18, NULL, 94, 2, NULL),
|
||||
(10, 7, 7, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||
(11, 7, 8, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||
(12, 7, 9, 71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL),
|
||||
(13, 1, 10,71, NOW(), NULL, 1, 18, NULL, 94, 3, NULL);
|
||||
|
||||
|
||||
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
||||
|
@ -1380,13 +1380,6 @@ INSERT INTO `vn`.`entry`(`id`, `supplierFk`, `created`, `travelFk`, `isConfirmed
|
|||
(7, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 7', 0, 0, 'this is the note seven', 'observation seven'),
|
||||
(8, 2, DATE_ADD(util.VN_CURDATE(), INTERVAL -1 MONTH), 7, 0, 442, 'Movement 8', 1, 1, '', '');
|
||||
|
||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||
VALUES
|
||||
(1101, 500, NULL, 0.00, 0.00, 1.00),
|
||||
(1102, 1000, 2.00, 0.01, 0.05, 1.00),
|
||||
(1103, 2000, 0.00, 0.00, 0.02, 1.00),
|
||||
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||
|
||||
INSERT INTO `bs`.`waste`(`buyer`, `year`, `week`, `family`, `itemFk`, `itemTypeFk`, `saleTotal`, `saleWaste`, `rate`)
|
||||
VALUES
|
||||
('CharlesXavier', YEAR(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK)), WEEK(DATE_ADD(util.VN_CURDATE(), INTERVAL -1 WEEK), 1), 'Carnation', 1, 1, '1062', '51', '4.8'),
|
||||
|
@ -1743,12 +1736,12 @@ INSERT INTO `vn`.`claimState`(`id`, `code`, `description`, `roleFk`, `priority`,
|
|||
( 6, 'mana', 'Mana', 1, 4, 0),
|
||||
( 7, 'lack', 'Faltas', 1, 2, 0);
|
||||
|
||||
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`)
|
||||
INSERT INTO `vn`.`claim`(`id`, `ticketCreated`, `claimStateFk`, `clientFk`, `workerFk`, `responsibility`, `isChargedToMana`, `created`, `packages`, `rma`)
|
||||
VALUES
|
||||
(1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0),
|
||||
(2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1),
|
||||
(3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5),
|
||||
(4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10);
|
||||
(1, util.VN_CURDATE(), 1, 1101, 18, 3, 0, util.VN_CURDATE(), 0, '02676A049183'),
|
||||
(2, util.VN_CURDATE(), 2, 1101, 18, 3, 0, util.VN_CURDATE(), 1, NULL),
|
||||
(3, util.VN_CURDATE(), 3, 1101, 18, 1, 1, util.VN_CURDATE(), 5, NULL),
|
||||
(4, util.VN_CURDATE(), 3, 1104, 18, 5, 0, util.VN_CURDATE(), 10, NULL);
|
||||
|
||||
INSERT INTO `vn`.`claimObservation` (`claimFk`, `workerFk`, `text`, `created`)
|
||||
VALUES
|
||||
|
@ -1790,6 +1783,23 @@ INSERT INTO `vn`.`claimConfig`(`id`, `pickupContact`, `maxResponsibility`)
|
|||
(1, 'Contact description', 50),
|
||||
(2, 'Contact description', 30);
|
||||
|
||||
INSERT INTO `vn`.`claimRatio`(`clientFk`, `yearSale`, `claimAmount`, `claimingRate`, `priceIncreasing`, `packingRate`)
|
||||
VALUES
|
||||
(1101, 500, NULL, 0.00, 0.00, 1.00),
|
||||
(1102, 1000, 2.00, 0.01, 0.05, 1.00),
|
||||
(1103, 2000, 0.00, 0.00, 0.02, 1.00),
|
||||
(1104, 2500, 150.00, 0.02, 0.10, 1.00);
|
||||
|
||||
INSERT INTO vn.claimRma (`id`, `code`, `created`, `workerFk`)
|
||||
VALUES
|
||||
(1, '02676A049183', DEFAULT, 1106),
|
||||
(2, '02676A049183', DEFAULT, 1106),
|
||||
(3, '02676A049183', DEFAULT, 1107),
|
||||
(4, '02676A049183', DEFAULT, 1107),
|
||||
(5, '01837B023653', DEFAULT, 1106);
|
||||
|
||||
|
||||
|
||||
INSERT INTO `hedera`.`tpvMerchant`(`id`, `description`, `companyFk`, `bankFk`, `secretKey`)
|
||||
VALUES
|
||||
(1, 'Arkham Bank', 442, 1, 'h12387193H10238'),
|
||||
|
@ -2648,6 +2658,39 @@ INSERT INTO `vn`.`workerTimeControlConfig` (`id`, `dayBreak`, `dayBreakDriver`,
|
|||
VALUES
|
||||
(1, 43200, 32400, 129600, 259200, 604800, '', '', 'Leidos.exito', 'Leidos.error', 'timeControl', 5.33, 0.33, 40, '22:00:00', '06:00:00', 57600, 1200, 18000, 57600, 6, 13);
|
||||
|
||||
INSERT INTO `vn`.`host` (`id`, `code`, `description`, `warehouseFk`, `bankFk`)
|
||||
VALUES
|
||||
(1, 'pc1', 'pc host', 1, 1);
|
||||
|
||||
INSERT INTO `vn`.`packingSite` (`id`, `code`, `hostFk`, `monitorId`)
|
||||
VALUES
|
||||
(1, 'h1', 1, '');
|
||||
|
||||
INSERT INTO `vn`.`packingSiteConfig` (`shinobiUrl`, `shinobiToken`, `shinobiGroupKey`, `avgBoxingTime`)
|
||||
VALUES
|
||||
('', 'SHINNOBI_TOKEN', 'GROUP_TOKEN', 6000);
|
||||
INSERT INTO `util`.`notificationConfig`
|
||||
SET `cleanDays` = 90;
|
||||
|
||||
INSERT INTO `util`.`notification` (`id`, `name`, `description`)
|
||||
VALUES
|
||||
(1, 'print-email', 'notification fixture one');
|
||||
|
||||
INSERT INTO `util`.`notificationAcl` (`notificationFk`, `roleFk`)
|
||||
VALUES
|
||||
(1, 9);
|
||||
|
||||
INSERT INTO `util`.`notificationQueue` (`id`, `notificationFk`, `params`, `authorFk`, `status`, `created`)
|
||||
VALUES
|
||||
(1, 'print-email', '{"id": "1"}', 9, 'pending', util.VN_CURDATE()),
|
||||
(2, 'print-email', '{"id": "2"}', null, 'pending', util.VN_CURDATE()),
|
||||
(3, 'print-email', null, null, 'pending', util.VN_CURDATE());
|
||||
|
||||
INSERT INTO `util`.`notificationSubscription` (`notificationFk`, `userFk`)
|
||||
VALUES
|
||||
(1, 1109),
|
||||
(1, 1110);
|
||||
|
||||
INSERT INTO `vn`.`routeConfig` (`id`, `defaultWorkCenterFk`)
|
||||
VALUES
|
||||
(1, 9);
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('Supplier fiscal data path', () => {
|
|||
await page.clearInput(selectors.supplierFiscalData.taxNumber);
|
||||
await page.write(selectors.supplierFiscalData.taxNumber, 'Wrong tax number');
|
||||
await page.clearInput(selectors.supplierFiscalData.account);
|
||||
await page.write(selectors.supplierFiscalData.account, 'edited account number');
|
||||
await page.write(selectors.supplierFiscalData.account, '0123456789');
|
||||
await page.autocompleteSearch(selectors.supplierFiscalData.sageWihholding, 'retencion estimacion objetiva');
|
||||
await page.autocompleteSearch(selectors.supplierFiscalData.sageTaxType, 'operaciones no sujetas');
|
||||
|
||||
|
@ -70,7 +70,7 @@ describe('Supplier fiscal data path', () => {
|
|||
it('should check the account was edited', async() => {
|
||||
const result = await page.waitToGetProperty(selectors.supplierFiscalData.account, 'value');
|
||||
|
||||
expect(result).toEqual('edited account number');
|
||||
expect(result).toEqual('0123456789');
|
||||
});
|
||||
|
||||
it('should check the sageWihholding was edited', async() => {
|
||||
|
|
|
@ -29,4 +29,13 @@ describe('Account LDAP path', () => {
|
|||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should reset data', async() => {
|
||||
await page.waitToClick(selectors.accountLdap.checkEnable);
|
||||
await page.waitToClick(selectors.accountLdap.save);
|
||||
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -29,4 +29,13 @@ describe('Account Samba path', () => {
|
|||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
|
||||
it('should reset data', async() => {
|
||||
await page.waitToClick(selectors.accountSamba.checkEnable);
|
||||
await page.waitToClick(selectors.accountSamba.save);
|
||||
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain('Data saved!');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('Account privileges path', () => {
|
|||
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain(`You don't have enough privileges`);
|
||||
expect(message.text).toContain(`You don't have grant privilege`);
|
||||
});
|
||||
|
||||
it('should throw error when change role', async() => {
|
||||
|
@ -33,7 +33,7 @@ describe('Account privileges path', () => {
|
|||
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain(`You don't have enough privileges`);
|
||||
expect(message.text).toContain(`You don't have grant privilege`);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -56,7 +56,16 @@ describe('Account privileges path', () => {
|
|||
expect(result).toBe('checked');
|
||||
});
|
||||
|
||||
it('should change role', async() => {
|
||||
it('should throw error when change role and not own role', async() => {
|
||||
await page.autocompleteSearch(selectors.accountPrivileges.role, 'itBoss');
|
||||
await page.waitToClick(selectors.accountPrivileges.save);
|
||||
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain(`You don't own the role and you can't assign it to another user`);
|
||||
});
|
||||
|
||||
it('should change role to employee', async() => {
|
||||
await page.autocompleteSearch(selectors.accountPrivileges.role, 'employee');
|
||||
await page.waitToClick(selectors.accountPrivileges.save);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
@ -67,6 +76,18 @@ describe('Account privileges path', () => {
|
|||
expect(message.text).toContain(`Data saved!`);
|
||||
expect(result).toContain('employee');
|
||||
});
|
||||
|
||||
it('should return role to developer', async() => {
|
||||
await page.autocompleteSearch(selectors.accountPrivileges.role, 'developer');
|
||||
await page.waitToClick(selectors.accountPrivileges.save);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
await page.reloadSection('account.card.privileges');
|
||||
const result = await page.waitToGetProperty(selectors.accountPrivileges.role, 'value');
|
||||
|
||||
expect(message.text).toContain(`Data saved!`);
|
||||
expect(result).toContain('developer');
|
||||
});
|
||||
});
|
||||
|
||||
describe('as developer again', () => {
|
||||
|
@ -76,7 +97,12 @@ describe('Account privileges path', () => {
|
|||
|
||||
await page.waitToClick(selectors.accountPrivileges.checkHasGrant);
|
||||
await page.waitToClick(selectors.accountPrivileges.save);
|
||||
const message = await page.waitForSnackbar();
|
||||
|
||||
expect(message.text).toContain(`Data saved!`);
|
||||
});
|
||||
|
||||
it('should logIn in developer', async() => {
|
||||
await page.reloadSection('account.card.privileges');
|
||||
const result = await page.checkboxState(selectors.accountPrivileges.checkHasGrant);
|
||||
|
||||
|
|
|
@ -54,6 +54,21 @@ export default class App {
|
|||
localStorage.setItem('salix-version', newVersion);
|
||||
}
|
||||
}
|
||||
|
||||
getUrl(route, appName = 'lilium') {
|
||||
const env = process.env.NODE_ENV;
|
||||
const filter = {
|
||||
where: {and: [
|
||||
{appName: appName},
|
||||
{environment: env}
|
||||
]}
|
||||
};
|
||||
|
||||
return this.logger.$http.get('Urls/findOne', {filter})
|
||||
.then(res => {
|
||||
return res.data.url + route;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.service('vnApp', App);
|
||||
|
|
|
@ -133,5 +133,7 @@
|
|||
"Descanso semanal 36h. / 72h.": "Weekly rest 36h. / 72h.",
|
||||
"Password does not meet requirements": "Password does not meet requirements",
|
||||
"You don't have privileges to change the zone": "You don't have privileges to change the zone or for these parameters there are more than one shipping options, talk to agencies",
|
||||
"Not enough privileges to edit a client": "Not enough privileges to edit a client"
|
||||
"Not enough privileges to edit a client": "Not enough privileges to edit a client",
|
||||
"You don't have grant privilege": "You don't have grant privilege",
|
||||
"You don't own the role and you can't assign it to another user": "You don't own the role and you can't assign it to another user"
|
||||
}
|
|
@ -235,5 +235,7 @@
|
|||
"Dirección incorrecta": "Dirección incorrecta",
|
||||
"Modifiable user details only by an administrator": "Detalles de usuario modificables solo por un administrador",
|
||||
"Modifiable password only via recovery or by an administrator": "Contraseña modificable solo a través de la recuperación o por un administrador",
|
||||
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente"
|
||||
"Not enough privileges to edit a client": "No tienes suficientes privilegios para editar un cliente",
|
||||
"You don't have grant privilege": "No tienes privilegios para dar privilegios",
|
||||
"You don't own the role and you can't assign it to another user": "No eres el propietario del rol y no puedes asignarlo a otro usuario"
|
||||
}
|
|
@ -1,2 +1,2 @@
|
|||
Privileges: Privilegios
|
||||
Has grant: Tiene privilegios
|
||||
Has grant: Puede delegar privilegios
|
||||
|
|
|
@ -47,7 +47,7 @@ module.exports = Self => {
|
|||
{
|
||||
relation: 'claimState',
|
||||
scope: {
|
||||
fields: ['id', 'description']
|
||||
fields: ['id', 'code', 'description']
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
"Claim": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ClaimContainer": {
|
||||
"dataSource": "claimStorage"
|
||||
},
|
||||
"ClaimBeginning": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
@ -41,7 +44,7 @@
|
|||
"ClaimObservation": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ClaimContainer": {
|
||||
"dataSource": "claimStorage"
|
||||
"ClaimRma": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.observe('before save', async function(ctx) {
|
||||
const changes = ctx.data || ctx.instance;
|
||||
const loopBackContext = LoopBackContext.getCurrentContext();
|
||||
changes.workerFk = loopBackContext.active.accessToken.userId;
|
||||
});
|
||||
};
|
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"name": "ClaimRma",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "claimRma"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"code": {
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -46,6 +46,9 @@
|
|||
},
|
||||
"packages": {
|
||||
"type": "number"
|
||||
},
|
||||
"rma": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
@ -54,6 +57,12 @@
|
|||
"model": "ClaimState",
|
||||
"foreignKey": "claimStateFk"
|
||||
},
|
||||
"rmas": {
|
||||
"type": "hasMany",
|
||||
"model": "ClaimRma",
|
||||
"foreignKey": "code",
|
||||
"primaryKey": "rma"
|
||||
},
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
|
|
|
@ -25,10 +25,9 @@ module.exports = Self => {
|
|||
|
||||
const client = await Self.app.models.Client.findById(id, myOptions);
|
||||
|
||||
const emails = client.email ? client.email.split(',') : null;
|
||||
|
||||
const findParams = [];
|
||||
if (emails.length) {
|
||||
if (client.email) {
|
||||
const emails = client.email.split(',');
|
||||
for (let email of emails)
|
||||
findParams.push({email: email});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
const {Report} = require('vn-print');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('receiptPdf', {
|
||||
description: 'Returns the receipt pdf',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'The claim id',
|
||||
http: {source: 'path'}
|
||||
},
|
||||
{
|
||||
arg: 'recipientId',
|
||||
type: 'number',
|
||||
description: 'The recipient id',
|
||||
required: false
|
||||
}
|
||||
],
|
||||
returns: [
|
||||
{
|
||||
arg: 'body',
|
||||
type: 'file',
|
||||
root: true
|
||||
}, {
|
||||
arg: 'Content-Type',
|
||||
type: 'String',
|
||||
http: {target: 'header'}
|
||||
}, {
|
||||
arg: 'Content-Disposition',
|
||||
type: 'String',
|
||||
http: {target: 'header'}
|
||||
}
|
||||
],
|
||||
http: {
|
||||
path: '/:id/receipt-pdf',
|
||||
verb: 'GET'
|
||||
}
|
||||
});
|
||||
|
||||
Self.receiptPdf = async(ctx, id) => {
|
||||
const args = Object.assign({}, ctx.args);
|
||||
const params = {lang: ctx.req.getLocale()};
|
||||
|
||||
delete args.ctx;
|
||||
for (const param in args)
|
||||
params[param] = args[param];
|
||||
|
||||
const report = new Report('receipt', params);
|
||||
const stream = await report.toPdfStream();
|
||||
|
||||
return [stream, 'application/pdf', `filename="doc-${id}.pdf"`];
|
||||
};
|
||||
};
|
|
@ -425,6 +425,7 @@ module.exports = Self => {
|
|||
|
||||
account.observe('before save', async ctx => {
|
||||
if (ctx.isNewInstance) return;
|
||||
if (ctx.currentInstance)
|
||||
ctx.hookState.oldInstance = JSON.parse(JSON.stringify(ctx.currentInstance));
|
||||
});
|
||||
|
||||
|
@ -432,7 +433,11 @@ module.exports = Self => {
|
|||
const changes = ctx.data || ctx.instance;
|
||||
if (!ctx.isNewInstance && changes) {
|
||||
const oldData = ctx.hookState.oldInstance;
|
||||
const hasChanges = oldData.name != changes.name || oldData.active != changes.active;
|
||||
let hasChanges;
|
||||
|
||||
if (oldData)
|
||||
hasChanges = oldData.name != changes.name || oldData.active != changes.active;
|
||||
|
||||
if (!hasChanges) return;
|
||||
|
||||
const isClient = await Self.app.models.Client.count({id: oldData.id});
|
||||
|
|
|
@ -2,6 +2,7 @@ const LoopBackContext = require('loopback-context');
|
|||
|
||||
module.exports = function(Self) {
|
||||
require('../methods/receipt/filter')(Self);
|
||||
require('../methods/receipt/receiptPdf')(Self);
|
||||
|
||||
Self.validateBinded('amountPaid', isNotZero, {
|
||||
message: 'Amount cannot be zero',
|
||||
|
|
|
@ -144,12 +144,8 @@ class Controller extends Dialog {
|
|||
})
|
||||
.then(() => this.vnApp.showSuccess(this.$t('Data saved!')))
|
||||
.then(() => {
|
||||
if (this.viewReceipt) {
|
||||
this.vnReport.show('receipt', {
|
||||
receiptId: receiptId,
|
||||
companyId: this.companyFk
|
||||
});
|
||||
}
|
||||
if (this.viewReceipt)
|
||||
this.vnReport.show(`Receipts/${receiptId}/receipt-pdf`);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,8 @@ describe('Client', () => {
|
|||
});
|
||||
|
||||
it('should make an http POST query and then call to the report show() method', () => {
|
||||
const receiptId = 1;
|
||||
|
||||
jest.spyOn(controller.vnApp, 'showSuccess');
|
||||
jest.spyOn(controller.vnReport, 'show');
|
||||
window.open = jest.fn();
|
||||
|
@ -92,14 +94,12 @@ describe('Client', () => {
|
|||
controller.$params = {id: 1101};
|
||||
controller.viewReceipt = true;
|
||||
|
||||
$httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: 1});
|
||||
$httpBackend.expect('POST', `Clients/1101/createReceipt`).respond({id: receiptId});
|
||||
controller.responseHandler('accept');
|
||||
$httpBackend.flush();
|
||||
|
||||
const expectedParams = {receiptId: 1, companyId: 442};
|
||||
|
||||
expect(controller.vnApp.showSuccess).toHaveBeenCalled();
|
||||
expect(controller.vnReport.show).toHaveBeenCalledWith('receipt', expectedParams);
|
||||
expect(controller.vnReport.show).toHaveBeenCalledWith(`Receipts/${receiptId}/receipt-pdf`);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ module.exports = Self => {
|
|||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'The client id',
|
||||
description: 'The route id',
|
||||
http: {source: 'path'}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -39,10 +39,7 @@ export default class Controller extends Section {
|
|||
routes.push(route.id);
|
||||
const routesId = routes.join(',');
|
||||
|
||||
this.vnReport.show('driver-route', {
|
||||
authorization: this.vnToken.token,
|
||||
routeId: routesId
|
||||
});
|
||||
this.vnReport.show(`Routes/${routesId}/driver-route-pdf`);
|
||||
}
|
||||
|
||||
openClonationDialog() {
|
||||
|
|
|
@ -49,14 +49,12 @@ describe('Component vnRouteIndex', () => {
|
|||
const data = controller.$.model.data;
|
||||
data[0].checked = true;
|
||||
data[2].checked = true;
|
||||
const expectedParams = {
|
||||
authorization: null,
|
||||
routeId: '1,3'
|
||||
};
|
||||
|
||||
const routeIds = '1,3';
|
||||
|
||||
controller.showRouteReport();
|
||||
|
||||
expect(controller.vnReport.show).toHaveBeenCalledWith('driver-route', expectedParams);
|
||||
expect(controller.vnReport.show).toHaveBeenCalledWith(`Routes/${routeIds}/driver-route-pdf`);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -95,8 +95,8 @@ module.exports = Self => {
|
|||
pm.name AS payMethod,
|
||||
pd.payDem AS payDem
|
||||
FROM vn.supplier s
|
||||
JOIN vn.payMethod pm ON pm.id = s.payMethodFk
|
||||
JOIN vn.payDem pd ON pd.id = s.payDemFk`
|
||||
LEFT JOIN vn.payMethod pm ON pm.id = s.payMethodFk
|
||||
LEFT JOIN vn.payDem pd ON pd.id = s.payDemFk`
|
||||
);
|
||||
|
||||
stmt.merge(conn.makeSuffix(filter));
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethod('newSupplier', {
|
||||
description: 'Creates a new supplier and returns it',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
arg: 'params',
|
||||
type: 'object',
|
||||
http: {source: 'body'}
|
||||
}],
|
||||
returns: {
|
||||
type: 'string',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/newSupplier`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.newSupplier = async params => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof(params) == 'string')
|
||||
params = JSON.parse(params);
|
||||
|
||||
params.nickname = params.name;
|
||||
|
||||
if (!myOptions.transaction) {
|
||||
tx = await Self.beginTransaction({});
|
||||
myOptions.transaction = tx;
|
||||
}
|
||||
|
||||
try {
|
||||
const supplier = await models.Supplier.create(params, myOptions);
|
||||
|
||||
if (tx) await tx.commit();
|
||||
|
||||
return supplier;
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
return params;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -10,7 +10,7 @@ describe('Supplier filter()', () => {
|
|||
|
||||
let result = await app.models.Supplier.filter(ctx);
|
||||
|
||||
expect(result.length).toEqual(1);
|
||||
expect(result.length).toBeGreaterThanOrEqual(1);
|
||||
expect(result[0].id).toEqual(1);
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const LoopBackContext = require('loopback-context');
|
||||
|
||||
describe('Supplier newSupplier()', () => {
|
||||
const newSupp = {
|
||||
name: 'TestSupplier-1'
|
||||
};
|
||||
const administrativeId = 5;
|
||||
|
||||
it('should create a new supplier containing only the name', async() => {
|
||||
const activeCtx = {
|
||||
accessToken: {userId: administrativeId},
|
||||
};
|
||||
spyOn(LoopBackContext, 'getCurrentContext').and.returnValue({
|
||||
active: activeCtx
|
||||
});
|
||||
|
||||
let result = await app.models.Supplier.newSupplier(JSON.stringify(newSupp));
|
||||
|
||||
expect(result.name).toEqual('TestSupplier-1');
|
||||
expect(result.id).toEqual(443);
|
||||
|
||||
const createdSupplier = await app.models.Supplier.findById(result.id);
|
||||
|
||||
expect(createdSupplier.id).toEqual(result.id);
|
||||
expect(createdSupplier.name).toEqual(result.name);
|
||||
expect(createdSupplier.payDemFk).toEqual(7);
|
||||
expect(createdSupplier.nickname).toEqual(result.name);
|
||||
});
|
||||
});
|
|
@ -10,6 +10,7 @@ module.exports = Self => {
|
|||
require('../methods/supplier/freeAgencies')(Self);
|
||||
require('../methods/supplier/campaignMetricsPdf')(Self);
|
||||
require('../methods/supplier/campaignMetricsEmail')(Self);
|
||||
require('../methods/supplier/newSupplier')(Self);
|
||||
|
||||
Self.validatesPresenceOf('name', {
|
||||
message: 'The social name cannot be empty'
|
||||
|
@ -19,13 +20,17 @@ module.exports = Self => {
|
|||
message: 'The supplier name must be unique'
|
||||
});
|
||||
|
||||
if (this.city) {
|
||||
Self.validatesPresenceOf('city', {
|
||||
message: 'City cannot be empty'
|
||||
});
|
||||
}
|
||||
|
||||
if (this.nif) {
|
||||
Self.validatesPresenceOf('nif', {
|
||||
message: 'The nif cannot be empty'
|
||||
});
|
||||
}
|
||||
|
||||
Self.validatesUniquenessOf('nif', {
|
||||
message: 'TIN must be unique'
|
||||
|
@ -57,6 +62,9 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
async function tinIsValid(err, done) {
|
||||
if (!this.countryFk)
|
||||
return done();
|
||||
|
||||
const filter = {
|
||||
fields: ['code'],
|
||||
where: {id: this.countryFk}
|
||||
|
@ -80,6 +88,7 @@ module.exports = Self => {
|
|||
});
|
||||
|
||||
async function hasSupplierAccount(err, done) {
|
||||
if (!this.payMethodFk) return done();
|
||||
const payMethod = await Self.app.models.PayMethod.findById(this.payMethodFk);
|
||||
const supplierAccount = await Self.app.models.SupplierAccount.findOne({where: {supplierFk: this.id}});
|
||||
const hasIban = supplierAccount && supplierAccount.iban;
|
||||
|
@ -92,6 +101,7 @@ module.exports = Self => {
|
|||
}
|
||||
|
||||
Self.observe('before save', async function(ctx) {
|
||||
if (ctx.isNewInstance) return;
|
||||
const loopbackContext = LoopBackContext.getCurrentContext();
|
||||
const changes = ctx.data || ctx.instance;
|
||||
const orgData = ctx.currentInstance;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
<vn-watcher
|
||||
vn-id="watcher"
|
||||
url="suppliers/newSupplier"
|
||||
data="$ctrl.supplier"
|
||||
insert-mode="true"
|
||||
form="form">
|
||||
</vn-watcher>
|
||||
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
|
||||
<vn-card class="vn-pa-lg">
|
||||
<vn-horizontal>
|
||||
<vn-textfield
|
||||
label="Supplier name"
|
||||
ng-model="$ctrl.supplier.name"
|
||||
vn-focus>
|
||||
</vn-textfield>
|
||||
</vn-horizontal>
|
||||
</vn-card>
|
||||
<vn-button-bar>
|
||||
<vn-submit
|
||||
disabled="!watcher.dataChanged()"
|
||||
label="Create">
|
||||
</vn-submit>
|
||||
<vn-button
|
||||
class="cancel"
|
||||
label="Cancel"
|
||||
ui-sref="supplier.index">
|
||||
</vn-button>
|
||||
</vn-button-bar>
|
||||
</form>
|
|
@ -0,0 +1,23 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.$.watcher.submit().then(
|
||||
json => {
|
||||
this.$state.go(`supplier.card.fiscalData`, {id: json.data.id});
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Controller.$inject = ['$element', '$scope'];
|
||||
|
||||
ngModule.vnComponent('vnSupplierCreate', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -20,3 +20,4 @@ import './address/create';
|
|||
import './address/edit';
|
||||
import './agency-term/index';
|
||||
import './agency-term/create';
|
||||
import './create/index';
|
||||
|
|
|
@ -59,3 +59,6 @@
|
|||
supplier="$ctrl.supplierSelected">
|
||||
</vn-supplier-summary>
|
||||
</vn-popup>
|
||||
<a vn-acl-action="remove" vn-acl="administrative" ui-sref="supplier.create" vn-tooltip="New supplier" vn-bind="+" fixed-bottom-right>
|
||||
<vn-float-button icon="add"></vn-float-button>
|
||||
</a>
|
|
@ -3,3 +3,4 @@ Pay day: Dia de pago
|
|||
Account: Cuenta
|
||||
Pay method: Metodo de pago
|
||||
Tax number: Nif
|
||||
New supplier: Nuevo proveedor
|
|
@ -52,6 +52,13 @@
|
|||
"supplier": "$ctrl.supplier"
|
||||
}
|
||||
},
|
||||
{
|
||||
"url": "/create",
|
||||
"state": "supplier.create",
|
||||
"component": "vn-supplier-create",
|
||||
"acl": ["administrative"],
|
||||
"description": "New supplier"
|
||||
},
|
||||
{
|
||||
"url": "/basic-data",
|
||||
"state": "supplier.card.basicData",
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
const https = require('https');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('getVideo', {
|
||||
description: 'Get packing video',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'Ticket id'
|
||||
},
|
||||
{
|
||||
arg: 'filename',
|
||||
type: 'string',
|
||||
required: true,
|
||||
description: 'Time to add'
|
||||
},
|
||||
{
|
||||
arg: 'req',
|
||||
type: 'object',
|
||||
http: {source: 'req'}
|
||||
},
|
||||
{
|
||||
arg: 'res',
|
||||
type: 'object',
|
||||
http: {source: 'res'}
|
||||
}
|
||||
],
|
||||
http: {
|
||||
path: `/getVideo`,
|
||||
verb: 'GET',
|
||||
},
|
||||
});
|
||||
|
||||
Self.getVideo = async(id, filename, req, res, options) => {
|
||||
const models = Self.app.models;
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions);
|
||||
|
||||
const query = `
|
||||
SELECT
|
||||
e.id,
|
||||
ps.monitorId,
|
||||
e.created
|
||||
FROM expedition e
|
||||
JOIN host h ON Convert(h.code USING utf8mb3) COLLATE utf8mb3_unicode_ci = e.hostFk
|
||||
JOIN packingSite ps ON ps.hostFk = h.id
|
||||
WHERE e.id = ?;`;
|
||||
const [expedition] = await models.Expedition.rawSql(query, [id]);
|
||||
const monitorId = expedition.monitorId;
|
||||
|
||||
const videoUrl =
|
||||
`/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${monitorId}/${filename}`;
|
||||
|
||||
const headers = Object.assign({}, req.headers, {
|
||||
host: 'shinobi.verdnatura.es'
|
||||
});
|
||||
const httpOptions = {
|
||||
host: 'shinobi.verdnatura.es',
|
||||
path: videoUrl,
|
||||
port: 443,
|
||||
headers
|
||||
};
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const req = https.request(httpOptions, shinobiRes => {
|
||||
shinobiRes.pause();
|
||||
res.writeHeader(shinobiRes.statusCode, shinobiRes.headers);
|
||||
shinobiRes.pipe(res);
|
||||
});
|
||||
|
||||
req.on('error', () => {
|
||||
reject();
|
||||
});
|
||||
|
||||
req.on('end', () => {
|
||||
resolve();
|
||||
});
|
||||
req.end();
|
||||
});
|
||||
};
|
||||
};
|
|
@ -0,0 +1,78 @@
|
|||
const axios = require('axios');
|
||||
const models = require('vn-loopback/server/server').models;
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('getVideoList', {
|
||||
description: 'Get video list of expedition id',
|
||||
accessType: 'READ',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'id',
|
||||
type: 'number',
|
||||
required: true,
|
||||
description: 'Expedition id'
|
||||
}, {
|
||||
arg: 'from',
|
||||
type: 'number',
|
||||
required: false,
|
||||
}, {
|
||||
arg: 'to',
|
||||
type: 'number',
|
||||
required: false,
|
||||
}
|
||||
], returns: {
|
||||
type: ['object'],
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/getVideoList`,
|
||||
verb: 'GET',
|
||||
},
|
||||
});
|
||||
|
||||
Self.getVideoList = async(id, from, to, options) => {
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
const packingSiteConfig = await models.PackingSiteConfig.findOne({}, myOptions);
|
||||
|
||||
const query = `
|
||||
SELECT
|
||||
e.id,
|
||||
ps.monitorId,
|
||||
e.created
|
||||
FROM expedition e
|
||||
JOIN host h ON Convert(h.code USING utf8mb3) COLLATE utf8mb3_unicode_ci = e.hostFk
|
||||
JOIN packingSite ps ON ps.hostFk = h.id
|
||||
WHERE e.id = ?;`;
|
||||
const [expedition] = await models.PackingSiteConfig.rawSql(query, [id]);
|
||||
|
||||
if (!from && !expedition) return [];
|
||||
let start = new Date(expedition.created);
|
||||
let end = new Date(start.getTime() + (packingSiteConfig.avgBoxingTime * 1000));
|
||||
|
||||
if (from && to) {
|
||||
start.setHours(from, 0, 0);
|
||||
end.setHours(to, 0, 0);
|
||||
}
|
||||
const offset = start.getTimezoneOffset();
|
||||
start = new Date(start.getTime() - (offset * 60 * 1000));
|
||||
end = new Date(end.getTime() - (offset * 60 * 1000));
|
||||
|
||||
const videoUrl =
|
||||
`/${packingSiteConfig.shinobiToken}/videos/${packingSiteConfig.shinobiGroupKey}/${expedition.monitorId}`;
|
||||
const timeUrl = `?start=${start.toISOString().split('.')[0]}&end=${end.toISOString().split('.')[0]}`;
|
||||
const url = `${packingSiteConfig.shinobiUrl}${videoUrl}${timeUrl}`;
|
||||
|
||||
let response;
|
||||
|
||||
try {
|
||||
response = await axios.get(url);
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
return response.data.videos.map(video => video.filename);
|
||||
};
|
||||
};
|
|
@ -0,0 +1,40 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const https = require('https');
|
||||
|
||||
xdescribe('boxing getVideo()', () => {
|
||||
it('should return data', async() => {
|
||||
const tx = await models.PackingSiteConfig.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const id = 1;
|
||||
const video = 'video.mp4';
|
||||
|
||||
const response = {
|
||||
pipe: () => {},
|
||||
on: () => {},
|
||||
end: () => {},
|
||||
};
|
||||
|
||||
const req = {
|
||||
headers: 'apiHeader',
|
||||
data: {
|
||||
pipe: () => {},
|
||||
on: () => {},
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(https, 'request').and.returnValue(response);
|
||||
|
||||
const result = await models.Boxing.getVideo(id, video, req, null, options);
|
||||
|
||||
expect(result[0]).toEqual(response.data.videos[0].filename);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -0,0 +1,36 @@
|
|||
const models = require('vn-loopback/server/server').models;
|
||||
const axios = require('axios');
|
||||
|
||||
describe('boxing getVideoList()', () => {
|
||||
it('should return video list', async() => {
|
||||
const tx = await models.PackingSiteConfig.beginTransaction({});
|
||||
|
||||
try {
|
||||
const options = {transaction: tx};
|
||||
|
||||
const id = 1;
|
||||
const from = 1;
|
||||
const to = 2;
|
||||
|
||||
const response = {
|
||||
data: {
|
||||
videos: [{
|
||||
id: 1,
|
||||
filename: 'video1.mp4'
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(axios, 'get').and.returnValue(new Promise(resolve => resolve(response)));
|
||||
|
||||
const result = await models.Boxing.getVideoList(id, from, to, options);
|
||||
|
||||
expect(result[0]).toEqual(response.data.videos[0].filename);
|
||||
|
||||
await tx.rollback();
|
||||
} catch (e) {
|
||||
await tx.rollback();
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
});
|
|
@ -52,7 +52,7 @@ module.exports = Self => {
|
|||
JOIN province p ON p.id = c.provinceFk
|
||||
JOIN country co ON co.id = p.countryFk
|
||||
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
|
||||
WHERE al.code = 'PACKED'
|
||||
WHERE al.code = 'PACKED' OR (am.code = 'refund' AND al.code != 'delivered')
|
||||
AND DATE(t.shipped) BETWEEN DATE_ADD(?, INTERVAL -2 DAY)
|
||||
AND util.dayEnd(?)
|
||||
AND t.refFk IS NULL
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
"AnnualAverageInvoiced": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Boxing": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Component": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
@ -20,6 +23,9 @@
|
|||
"Packaging": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"PackingSiteConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"PrintServerQueue": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
module.exports = Self => {
|
||||
require('../methods/boxing/getVideo')(Self);
|
||||
require('../methods/boxing/getVideoList')(Self);
|
||||
};
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "Boxing",
|
||||
"base": "PersistedModel",
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "PackingSiteConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "packingSiteConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"shinobiUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
"shinobiGroupKey":{
|
||||
"type":"string"
|
||||
},
|
||||
"shinobiToken":{
|
||||
"type":"string"
|
||||
},
|
||||
"avgBoxingTime":{
|
||||
"type":"number"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
<vn-card>
|
||||
</vn-card>
|
|
@ -0,0 +1,21 @@
|
|||
import ngModule from '../module';
|
||||
import Section from 'salix/components/section';
|
||||
|
||||
class Controller extends Section {
|
||||
constructor($element, $) {
|
||||
super($element, $);
|
||||
}
|
||||
|
||||
async $onInit() {
|
||||
const url = await this.vnApp.getUrl(`ticket/${this.$params.id}/boxing`);
|
||||
window.open(url).focus();
|
||||
}
|
||||
}
|
||||
|
||||
ngModule.vnComponent('vnTicketBoxing', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller,
|
||||
bindings: {
|
||||
ticket: '<'
|
||||
}
|
||||
});
|
|
@ -33,3 +33,4 @@ import './dms/index';
|
|||
import './dms/create';
|
||||
import './dms/edit';
|
||||
import './sms';
|
||||
import './boxing';
|
||||
|
|
|
@ -4,6 +4,7 @@ Agency: Agencia
|
|||
Amount: Importe
|
||||
Base to commission: Base comisionable
|
||||
Boxes: Cajas
|
||||
Boxing: Encajado
|
||||
by: por
|
||||
Checked: Comprobado
|
||||
Client: Cliente
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
{"state": "ticket.card.saleChecked", "icon": "assignment"},
|
||||
{"state": "ticket.card.components", "icon": "icon-components"},
|
||||
{"state": "ticket.card.saleTracking", "icon": "assignment"},
|
||||
{"state": "ticket.card.dms.index", "icon": "cloud_download"}
|
||||
{"state": "ticket.card.dms.index", "icon": "cloud_download"},
|
||||
{"state": "ticket.card.boxing", "icon": "science"}
|
||||
]
|
||||
},
|
||||
"keybindings": [
|
||||
|
@ -273,6 +274,15 @@
|
|||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
},
|
||||
{
|
||||
"url": "/boxing",
|
||||
"state": "ticket.card.boxing",
|
||||
"component": "vn-ticket-boxing",
|
||||
"description": "Boxing",
|
||||
"params": {
|
||||
"ticket": "$ctrl.ticket"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -64,6 +64,9 @@
|
|||
},
|
||||
"WorkerTimeControlMail": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"WorkerDisableExcluded": {
|
||||
"dataSource": "vn"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
"name": "WorkerDisableExcluded",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "workerDisableExcluded"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"workerFk": {
|
||||
"id": true,
|
||||
"type": "number"
|
||||
},
|
||||
"dated": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
{
|
||||
"accessType": "READ",
|
||||
"principalType": "ROLE",
|
||||
"principalId": "$everyone",
|
||||
"permission": "ALLOW"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -14,6 +14,20 @@
|
|||
</vn-float-button>
|
||||
</div>
|
||||
</slot-before>
|
||||
<slot-menu>
|
||||
<vn-item
|
||||
ng-click="$ctrl.handleExcluded()"
|
||||
translate
|
||||
ng-if="!$ctrl.excluded">
|
||||
Click to exclude the user from getting disabled
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-click="$ctrl.handleExcluded()"
|
||||
translate
|
||||
ng-if="$ctrl.excluded">
|
||||
Click to allow the user to be disabled
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
<div class="attributes">
|
||||
<vn-label-value
|
||||
|
@ -37,6 +51,13 @@
|
|||
value="{{$ctrl.worker.sip.extension}}">
|
||||
</vn-label-value>
|
||||
</div>
|
||||
<div class="icons">
|
||||
<vn-icon
|
||||
vn-tooltip="This user can't be disabled"
|
||||
icon="person"
|
||||
ng-if="$ctrl.worker.excluded">
|
||||
</vn-icon>
|
||||
</div>
|
||||
<div class="quicklinks">
|
||||
<div ng-transclude="btnOne">
|
||||
<vn-quick-link
|
||||
|
|
|
@ -13,6 +13,33 @@ class Controller extends Descriptor {
|
|||
|
||||
set worker(value) {
|
||||
this.entity = value;
|
||||
|
||||
if (value)
|
||||
this.getIsExcluded();
|
||||
}
|
||||
|
||||
get excluded() {
|
||||
return this.entity.excluded;
|
||||
}
|
||||
|
||||
set excluded(value) {
|
||||
this.entity.excluded = value;
|
||||
}
|
||||
|
||||
getIsExcluded() {
|
||||
this.$http.get(`workerDisableExcludeds/${this.entity.id}/exists`).then(data => {
|
||||
this.excluded = data.data.exists;
|
||||
});
|
||||
}
|
||||
|
||||
handleExcluded() {
|
||||
if (this.excluded) {
|
||||
this.$http.delete(`workerDisableExcludeds/${this.entity.id}`);
|
||||
this.excluded = false;
|
||||
} else {
|
||||
this.$http.post(`workerDisableExcludeds`, {workerFk: this.entity.id, dated: new Date});
|
||||
this.excluded = true;
|
||||
}
|
||||
}
|
||||
|
||||
loadData() {
|
||||
|
|
|
@ -21,3 +21,6 @@ Worker id: Id trabajador
|
|||
Workers: Trabajadores
|
||||
worker: trabajador
|
||||
Go to the worker: Ir al trabajador
|
||||
Click to exclude the user from getting disabled: Marcar para no deshabilitar
|
||||
Click to allow the user to be disabled: Marcar para deshabilitar
|
||||
This user can't be disabled: Fijado para no deshabilitar
|
|
@ -38,7 +38,7 @@
|
|||
"node-ssh": "^11.0.0",
|
||||
"object-diff": "0.0.4",
|
||||
"object.pick": "^1.3.0",
|
||||
"puppeteer": "^18.0.5",
|
||||
"puppeteer": "^19.0.0",
|
||||
"read-chunk": "^3.2.0",
|
||||
"require-yaml": "0.0.1",
|
||||
"sharp": "^0.31.0",
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
const express = require('express');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const templatesPath = path.resolve(__dirname, './templates');
|
||||
const componentsPath = path.resolve(__dirname, './core/components');
|
||||
|
||||
module.exports = async app => {
|
||||
global.appPath = __dirname;
|
||||
|
||||
process.env.OPENSSL_CONF = '/etc/ssl/';
|
||||
|
||||
// Extended locale intl polyfill
|
||||
const IntlPolyfill = require('intl');
|
||||
Intl.NumberFormat = IntlPolyfill.NumberFormat;
|
||||
Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
|
||||
|
||||
// Init database instance
|
||||
require('./core/database').init();
|
||||
// Init SMTP Instance
|
||||
require('./core/smtp').init();
|
||||
require('./core/mixins');
|
||||
require('./core/filters');
|
||||
require('./core/directives');
|
||||
// Init router
|
||||
require('./core/router')(app);
|
||||
|
||||
/**
|
||||
* Serve component static files
|
||||
*/
|
||||
const componentsDir = fs.readdirSync(componentsPath);
|
||||
componentsDir.forEach(componentName => {
|
||||
const componentDir = path.join(componentsPath, '/', componentName);
|
||||
const assetsDir = `${componentDir}/assets`;
|
||||
|
||||
app.use(`/api/${componentName}/assets`, express.static(assetsDir));
|
||||
});
|
||||
|
||||
/**
|
||||
* Serve static files
|
||||
*/
|
||||
const templatesDir = fs.readdirSync(templatesPath);
|
||||
templatesDir.forEach(directory => {
|
||||
const templateTypeDir = path.join(templatesPath, '/', directory);
|
||||
const templates = fs.readdirSync(templateTypeDir);
|
||||
|
||||
templates.forEach(templateName => {
|
||||
const templateDir = path.join(templatesPath, '/', directory, '/', templateName);
|
||||
const assetsDir = `${templateDir}/assets`;
|
||||
|
||||
app.use(`/api/${templateName}/assets`, express.static(assetsDir));
|
||||
});
|
||||
});
|
||||
};
|
|
@ -0,0 +1,42 @@
|
|||
const {Cluster} = require('puppeteer-cluster');
|
||||
const log4js = require('log4js');
|
||||
const {cpus} = require('os');
|
||||
|
||||
module.exports = {
|
||||
init() {
|
||||
if (!this.pool) {
|
||||
Cluster.launch({
|
||||
concurrency: Cluster.CONCURRENCY_CONTEXT,
|
||||
maxConcurrency: cpus().length,
|
||||
puppeteerOptions: {
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
'--no-zygote'
|
||||
]
|
||||
}
|
||||
})
|
||||
.then(cluster => {
|
||||
this.pool = cluster;
|
||||
|
||||
log4js.configure({
|
||||
appenders: {
|
||||
out: {type: 'stdout'}
|
||||
},
|
||||
categories: {default: {appenders: ['out'], level: 'info'}},
|
||||
});
|
||||
|
||||
const logger = log4js.getLogger();
|
||||
|
||||
cluster.on('taskerror', (err, data, willRetry) => {
|
||||
if (willRetry)
|
||||
logger.warn(`[Print] => ${err.message}\nThis job will be retried`);
|
||||
else
|
||||
logger.error(`[Print] => ${err.message}`);
|
||||
});
|
||||
|
||||
cluster.on('queue', () => logger.info('Printing task initialized by pool'));
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
|
@ -1,5 +1,4 @@
|
|||
const mysql = require('mysql2');
|
||||
const config = require('./config.js');
|
||||
const fs = require('fs-extra');
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -2,7 +2,7 @@ const fs = require('fs');
|
|||
const path = require('path');
|
||||
const config = require('./config');
|
||||
const Component = require('./component');
|
||||
const puppeteer = require('puppeteer');
|
||||
const Cluster = require('./cluster');
|
||||
|
||||
if (!process.env.OPENSSL_CONF)
|
||||
process.env.OPENSSL_CONF = '/etc/ssl/';
|
||||
|
@ -32,17 +32,8 @@ class Report extends Component {
|
|||
if (fs.existsSync(fullPath))
|
||||
options = require(optionsPath);
|
||||
|
||||
const browser = await puppeteer.launch({
|
||||
headless: true,
|
||||
args: [
|
||||
'--no-sandbox',
|
||||
'--disable-setuid-sandbox',
|
||||
'--single-process',
|
||||
'--no-zygote'
|
||||
]
|
||||
});
|
||||
|
||||
const page = (await browser.pages())[0];
|
||||
return new Promise(resolve => {
|
||||
Cluster.pool.queue({}, async({page}) => {
|
||||
await page.emulateMediaType('screen');
|
||||
await page.setContent(template);
|
||||
|
||||
|
@ -60,11 +51,11 @@ class Report extends Component {
|
|||
options.headerTemplate = '\n';
|
||||
options.footerTemplate = footer;
|
||||
|
||||
const buffer = await page.pdf(options);
|
||||
const stream = await page.pdf(options);
|
||||
|
||||
await browser.close();
|
||||
|
||||
return buffer;
|
||||
resolve(stream);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,10 +7,15 @@ const componentsPath = path.resolve(__dirname, './core/components');
|
|||
|
||||
module.exports = {
|
||||
async boot(app) {
|
||||
// Init database instance
|
||||
// Extended locale intl polyfill
|
||||
const IntlPolyfill = require('intl');
|
||||
Intl.NumberFormat = IntlPolyfill.NumberFormat;
|
||||
Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
|
||||
|
||||
// Init database instance
|
||||
require('./core/database').init(app.dataSources);
|
||||
require('./core/smtp').init();
|
||||
require('./core/cluster').init();
|
||||
require('./core/mixins');
|
||||
require('./core/filters');
|
||||
|
||||
|
|
|
@ -14,9 +14,10 @@
|
|||
"js-yaml": "^3.13.1",
|
||||
"jsonexport": "^3.2.0",
|
||||
"juice": "^5.2.0",
|
||||
"log4js": "^6.7.0",
|
||||
"mysql2": "^1.7.0",
|
||||
"nodemailer": "^4.7.0",
|
||||
"puppeteer": "^18.0.5",
|
||||
"puppeteer-cluster": "^0.23.0",
|
||||
"qrcode": "^1.4.2",
|
||||
"strftime": "^0.10.0",
|
||||
"vue": "^2.6.10",
|
||||
|
@ -37,12 +38,14 @@
|
|||
"node_modules/@types/node": {
|
||||
"version": "18.8.2",
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
"optional": true,
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/@types/yauzl": {
|
||||
"version": "2.10.0",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
|
@ -58,6 +61,7 @@
|
|||
"node_modules/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"debug": "4"
|
||||
},
|
||||
|
@ -138,7 +142,8 @@
|
|||
},
|
||||
"node_modules/balanced-match": {
|
||||
"version": "1.0.2",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
|
@ -156,7 +161,8 @@
|
|||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/bcrypt-pbkdf": {
|
||||
"version": "1.0.2",
|
||||
|
@ -168,6 +174,7 @@
|
|||
"node_modules/bl": {
|
||||
"version": "4.1.0",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
|
@ -181,6 +188,7 @@
|
|||
"node_modules/brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -203,6 +211,7 @@
|
|||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
|
@ -211,6 +220,7 @@
|
|||
"node_modules/buffer-crc32": {
|
||||
"version": "0.2.13",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
|
@ -265,7 +275,8 @@
|
|||
},
|
||||
"node_modules/chownr": {
|
||||
"version": "1.1.4",
|
||||
"license": "ISC"
|
||||
"license": "ISC",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/cliui": {
|
||||
"version": "6.0.0",
|
||||
|
@ -303,7 +314,8 @@
|
|||
},
|
||||
"node_modules/concat-map": {
|
||||
"version": "0.0.1",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/core-util-is": {
|
||||
"version": "1.0.2",
|
||||
|
@ -312,6 +324,7 @@
|
|||
"node_modules/cross-fetch": {
|
||||
"version": "3.1.5",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"node-fetch": "2.6.7"
|
||||
}
|
||||
|
@ -372,6 +385,14 @@
|
|||
"node": ">= 4"
|
||||
}
|
||||
},
|
||||
"node_modules/date-format": {
|
||||
"version": "4.0.14",
|
||||
"resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz",
|
||||
"integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg==",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.3.4",
|
||||
"license": "MIT",
|
||||
|
@ -417,7 +438,8 @@
|
|||
},
|
||||
"node_modules/devtools-protocol": {
|
||||
"version": "0.0.1045489",
|
||||
"license": "BSD-3-Clause"
|
||||
"license": "BSD-3-Clause",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/dijkstrajs": {
|
||||
"version": "1.0.2",
|
||||
|
@ -468,6 +490,7 @@
|
|||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
|
@ -501,6 +524,7 @@
|
|||
"node_modules/extract-zip": {
|
||||
"version": "2.0.1",
|
||||
"license": "BSD-2-Clause",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"debug": "^4.1.1",
|
||||
"get-stream": "^5.1.0",
|
||||
|
@ -534,6 +558,7 @@
|
|||
"node_modules/fd-slicer": {
|
||||
"version": "1.1.0",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"pend": "~1.2.0"
|
||||
}
|
||||
|
@ -549,6 +574,11 @@
|
|||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/flatted": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
|
||||
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ=="
|
||||
},
|
||||
"node_modules/forever-agent": {
|
||||
"version": "0.6.1",
|
||||
"license": "Apache-2.0",
|
||||
|
@ -570,7 +600,8 @@
|
|||
},
|
||||
"node_modules/fs-constants": {
|
||||
"version": "1.0.0",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/fs-extra": {
|
||||
"version": "7.0.1",
|
||||
|
@ -586,7 +617,8 @@
|
|||
},
|
||||
"node_modules/fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"license": "ISC"
|
||||
"license": "ISC",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
|
@ -609,6 +641,7 @@
|
|||
"node_modules/get-stream": {
|
||||
"version": "5.2.0",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"pump": "^3.0.0"
|
||||
},
|
||||
|
@ -629,6 +662,7 @@
|
|||
"node_modules/glob": {
|
||||
"version": "7.2.3",
|
||||
"license": "ISC",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
|
@ -723,6 +757,7 @@
|
|||
"node_modules/https-proxy-agent": {
|
||||
"version": "5.0.1",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
|
@ -757,7 +792,8 @@
|
|||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"license": "BSD-3-Clause"
|
||||
"license": "BSD-3-Clause",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/image-size": {
|
||||
"version": "0.7.5",
|
||||
|
@ -772,6 +808,7 @@
|
|||
"node_modules/inflight": {
|
||||
"version": "1.0.6",
|
||||
"license": "ISC",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
|
@ -976,6 +1013,21 @@
|
|||
"version": "4.5.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/log4js": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.0.tgz",
|
||||
"integrity": "sha512-KA0W9ffgNBLDj6fZCq/lRbgR6ABAodRIDHrZnS48vOtfKa4PzWImb0Md1lmGCdO3n3sbCm/n1/WmrNlZ8kCI3Q==",
|
||||
"dependencies": {
|
||||
"date-format": "^4.0.14",
|
||||
"debug": "^4.3.4",
|
||||
"flatted": "^3.2.7",
|
||||
"rfdc": "^1.3.0",
|
||||
"streamroller": "^3.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/long": {
|
||||
"version": "4.0.0",
|
||||
"license": "Apache-2.0"
|
||||
|
@ -1021,6 +1073,7 @@
|
|||
"node_modules/minimatch": {
|
||||
"version": "3.1.2",
|
||||
"license": "ISC",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
},
|
||||
|
@ -1030,7 +1083,8 @@
|
|||
},
|
||||
"node_modules/mkdirp-classic": {
|
||||
"version": "0.5.3",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.2",
|
||||
|
@ -1092,6 +1146,7 @@
|
|||
"node_modules/node-fetch": {
|
||||
"version": "2.6.7",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
},
|
||||
|
@ -1131,6 +1186,7 @@
|
|||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"license": "ISC",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -1175,6 +1231,7 @@
|
|||
"node_modules/path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
|
@ -1192,7 +1249,8 @@
|
|||
},
|
||||
"node_modules/pend": {
|
||||
"version": "1.2.0",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/performance-now": {
|
||||
"version": "2.1.0",
|
||||
|
@ -1234,13 +1292,15 @@
|
|||
"node_modules/progress": {
|
||||
"version": "2.0.3",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/pseudomap": {
|
||||
"version": "1.0.2",
|
||||
|
@ -1253,6 +1313,7 @@
|
|||
"node_modules/pump": {
|
||||
"version": "3.0.0",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
|
@ -1269,6 +1330,7 @@
|
|||
"version": "18.2.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"https-proxy-agent": "5.0.1",
|
||||
"progress": "2.0.3",
|
||||
|
@ -1279,9 +1341,21 @@
|
|||
"node": ">=14.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/puppeteer-cluster": {
|
||||
"version": "0.23.0",
|
||||
"resolved": "https://registry.npmjs.org/puppeteer-cluster/-/puppeteer-cluster-0.23.0.tgz",
|
||||
"integrity": "sha512-108terIWDzPrQopmoYSPd5yDoy3FGJ2dNnoGMkGYPs6xtkdhgaECwpfZkzaRToMQPZibUOz0/dSSGgPEdXEhkQ==",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"puppeteer": ">=1.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/puppeteer-core": {
|
||||
"version": "18.2.0",
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"cross-fetch": "3.1.5",
|
||||
"debug": "4.3.4",
|
||||
|
@ -1396,9 +1470,15 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/rfdc": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz",
|
||||
"integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA=="
|
||||
},
|
||||
"node_modules/rimraf": {
|
||||
"version": "3.0.2",
|
||||
"license": "ISC",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"glob": "^7.1.3"
|
||||
},
|
||||
|
@ -1524,6 +1604,32 @@
|
|||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/streamroller": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.3.tgz",
|
||||
"integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==",
|
||||
"dependencies": {
|
||||
"date-format": "^4.0.14",
|
||||
"debug": "^4.3.4",
|
||||
"fs-extra": "^8.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/streamroller/node_modules/fs-extra": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
|
||||
"dependencies": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6 <7 || >=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strftime": {
|
||||
"version": "0.10.1",
|
||||
"license": "MIT",
|
||||
|
@ -1583,6 +1689,7 @@
|
|||
"node_modules/tar-fs": {
|
||||
"version": "2.1.1",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"chownr": "^1.1.1",
|
||||
"mkdirp-classic": "^0.5.2",
|
||||
|
@ -1593,6 +1700,7 @@
|
|||
"node_modules/tar-stream": {
|
||||
"version": "2.2.0",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"bl": "^4.0.3",
|
||||
"end-of-stream": "^1.4.1",
|
||||
|
@ -1606,7 +1714,8 @@
|
|||
},
|
||||
"node_modules/through": {
|
||||
"version": "2.3.8",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
|
@ -1621,7 +1730,8 @@
|
|||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"license": "MIT"
|
||||
"license": "MIT",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
|
@ -1640,6 +1750,7 @@
|
|||
"node_modules/unbzip2-stream": {
|
||||
"version": "1.4.3",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"buffer": "^5.2.1",
|
||||
"through": "^2.3.8"
|
||||
|
@ -1891,11 +2002,13 @@
|
|||
},
|
||||
"node_modules/webidl-conversions": {
|
||||
"version": "3.0.1",
|
||||
"license": "BSD-2-Clause"
|
||||
"license": "BSD-2-Clause",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
|
@ -1956,11 +2069,13 @@
|
|||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"license": "ISC"
|
||||
"license": "ISC",
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.9.0",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
|
@ -2026,6 +2141,7 @@
|
|||
"node_modules/yauzl": {
|
||||
"version": "2.10.0",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"buffer-crc32": "~0.2.3",
|
||||
"fd-slicer": "~1.1.0"
|
||||
|
@ -2038,11 +2154,13 @@
|
|||
},
|
||||
"@types/node": {
|
||||
"version": "18.8.2",
|
||||
"optional": true
|
||||
"optional": true,
|
||||
"peer": true
|
||||
},
|
||||
"@types/yauzl": {
|
||||
"version": "2.10.0",
|
||||
"optional": true,
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
|
@ -2057,6 +2175,7 @@
|
|||
},
|
||||
"agent-base": {
|
||||
"version": "6.0.2",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"debug": "4"
|
||||
}
|
||||
|
@ -2107,10 +2226,12 @@
|
|||
"version": "1.11.0"
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "1.0.2"
|
||||
"version": "1.0.2",
|
||||
"peer": true
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1"
|
||||
"version": "1.5.1",
|
||||
"peer": true
|
||||
},
|
||||
"bcrypt-pbkdf": {
|
||||
"version": "1.0.2",
|
||||
|
@ -2120,6 +2241,7 @@
|
|||
},
|
||||
"bl": {
|
||||
"version": "4.1.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
|
@ -2131,6 +2253,7 @@
|
|||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.11",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"balanced-match": "^1.0.0",
|
||||
"concat-map": "0.0.1"
|
||||
|
@ -2138,13 +2261,15 @@
|
|||
},
|
||||
"buffer": {
|
||||
"version": "5.7.1",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"buffer-crc32": {
|
||||
"version": "0.2.13"
|
||||
"version": "0.2.13",
|
||||
"peer": true
|
||||
},
|
||||
"camelcase": {
|
||||
"version": "5.3.1"
|
||||
|
@ -2182,7 +2307,8 @@
|
|||
}
|
||||
},
|
||||
"chownr": {
|
||||
"version": "1.1.4"
|
||||
"version": "1.1.4",
|
||||
"peer": true
|
||||
},
|
||||
"cliui": {
|
||||
"version": "6.0.0",
|
||||
|
@ -2211,13 +2337,15 @@
|
|||
"version": "2.20.3"
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1"
|
||||
"version": "0.0.1",
|
||||
"peer": true
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2"
|
||||
},
|
||||
"cross-fetch": {
|
||||
"version": "3.1.5",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"node-fetch": "2.6.7"
|
||||
}
|
||||
|
@ -2260,6 +2388,11 @@
|
|||
"mimer": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"date-format": {
|
||||
"version": "4.0.14",
|
||||
"resolved": "https://registry.npmjs.org/date-format/-/date-format-4.0.14.tgz",
|
||||
"integrity": "sha512-39BOQLs9ZjKh0/patS9nrT8wc3ioX3/eA/zgbKNopnF2wCqJEoxywwwElATYvRsXdnOxA/OQeQoFZ3rFjVajhg=="
|
||||
},
|
||||
"debug": {
|
||||
"version": "4.3.4",
|
||||
"requires": {
|
||||
|
@ -2279,7 +2412,8 @@
|
|||
"version": "1.5.1"
|
||||
},
|
||||
"devtools-protocol": {
|
||||
"version": "0.0.1045489"
|
||||
"version": "0.0.1045489",
|
||||
"peer": true
|
||||
},
|
||||
"dijkstrajs": {
|
||||
"version": "1.0.2"
|
||||
|
@ -2322,6 +2456,7 @@
|
|||
},
|
||||
"end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
|
@ -2340,6 +2475,7 @@
|
|||
},
|
||||
"extract-zip": {
|
||||
"version": "2.0.1",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"@types/yauzl": "^2.9.1",
|
||||
"debug": "^4.1.1",
|
||||
|
@ -2358,6 +2494,7 @@
|
|||
},
|
||||
"fd-slicer": {
|
||||
"version": "1.1.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"pend": "~1.2.0"
|
||||
}
|
||||
|
@ -2369,6 +2506,11 @@
|
|||
"path-exists": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"flatted": {
|
||||
"version": "3.2.7",
|
||||
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
|
||||
"integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ=="
|
||||
},
|
||||
"forever-agent": {
|
||||
"version": "0.6.1"
|
||||
},
|
||||
|
@ -2381,7 +2523,8 @@
|
|||
}
|
||||
},
|
||||
"fs-constants": {
|
||||
"version": "1.0.0"
|
||||
"version": "1.0.0",
|
||||
"peer": true
|
||||
},
|
||||
"fs-extra": {
|
||||
"version": "7.0.1",
|
||||
|
@ -2392,7 +2535,8 @@
|
|||
}
|
||||
},
|
||||
"fs.realpath": {
|
||||
"version": "1.0.0"
|
||||
"version": "1.0.0",
|
||||
"peer": true
|
||||
},
|
||||
"function-bind": {
|
||||
"version": "1.1.1"
|
||||
|
@ -2408,6 +2552,7 @@
|
|||
},
|
||||
"get-stream": {
|
||||
"version": "5.2.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"pump": "^3.0.0"
|
||||
}
|
||||
|
@ -2420,6 +2565,7 @@
|
|||
},
|
||||
"glob": {
|
||||
"version": "7.2.3",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"fs.realpath": "^1.0.0",
|
||||
"inflight": "^1.0.4",
|
||||
|
@ -2478,6 +2624,7 @@
|
|||
},
|
||||
"https-proxy-agent": {
|
||||
"version": "5.0.1",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"agent-base": "6",
|
||||
"debug": "4"
|
||||
|
@ -2490,13 +2637,15 @@
|
|||
}
|
||||
},
|
||||
"ieee754": {
|
||||
"version": "1.2.1"
|
||||
"version": "1.2.1",
|
||||
"peer": true
|
||||
},
|
||||
"image-size": {
|
||||
"version": "0.7.5"
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
"wrappy": "1"
|
||||
|
@ -2642,6 +2791,18 @@
|
|||
"lodash.uniq": {
|
||||
"version": "4.5.0"
|
||||
},
|
||||
"log4js": {
|
||||
"version": "6.7.0",
|
||||
"resolved": "https://registry.npmjs.org/log4js/-/log4js-6.7.0.tgz",
|
||||
"integrity": "sha512-KA0W9ffgNBLDj6fZCq/lRbgR6ABAodRIDHrZnS48vOtfKa4PzWImb0Md1lmGCdO3n3sbCm/n1/WmrNlZ8kCI3Q==",
|
||||
"requires": {
|
||||
"date-format": "^4.0.14",
|
||||
"debug": "^4.3.4",
|
||||
"flatted": "^3.2.7",
|
||||
"rfdc": "^1.3.0",
|
||||
"streamroller": "^3.1.3"
|
||||
}
|
||||
},
|
||||
"long": {
|
||||
"version": "4.0.0"
|
||||
},
|
||||
|
@ -2668,12 +2829,14 @@
|
|||
},
|
||||
"minimatch": {
|
||||
"version": "3.1.2",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"brace-expansion": "^1.1.7"
|
||||
}
|
||||
},
|
||||
"mkdirp-classic": {
|
||||
"version": "0.5.3"
|
||||
"version": "0.5.3",
|
||||
"peer": true
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.1.2"
|
||||
|
@ -2717,6 +2880,7 @@
|
|||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.7",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"whatwg-url": "^5.0.0"
|
||||
}
|
||||
|
@ -2735,6 +2899,7 @@
|
|||
},
|
||||
"once": {
|
||||
"version": "1.4.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
|
@ -2758,7 +2923,8 @@
|
|||
"version": "4.0.0"
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.1"
|
||||
"version": "1.0.1",
|
||||
"peer": true
|
||||
},
|
||||
"path-key": {
|
||||
"version": "2.0.1"
|
||||
|
@ -2767,7 +2933,8 @@
|
|||
"version": "1.0.7"
|
||||
},
|
||||
"pend": {
|
||||
"version": "1.2.0"
|
||||
"version": "1.2.0",
|
||||
"peer": true
|
||||
},
|
||||
"performance-now": {
|
||||
"version": "2.1.0"
|
||||
|
@ -2787,10 +2954,12 @@
|
|||
}
|
||||
},
|
||||
"progress": {
|
||||
"version": "2.0.3"
|
||||
"version": "2.0.3",
|
||||
"peer": true
|
||||
},
|
||||
"proxy-from-env": {
|
||||
"version": "1.1.0"
|
||||
"version": "1.1.0",
|
||||
"peer": true
|
||||
},
|
||||
"pseudomap": {
|
||||
"version": "1.0.2"
|
||||
|
@ -2800,6 +2969,7 @@
|
|||
},
|
||||
"pump": {
|
||||
"version": "3.0.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
|
@ -2810,6 +2980,7 @@
|
|||
},
|
||||
"puppeteer": {
|
||||
"version": "18.2.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"https-proxy-agent": "5.0.1",
|
||||
"progress": "2.0.3",
|
||||
|
@ -2817,8 +2988,17 @@
|
|||
"puppeteer-core": "18.2.0"
|
||||
}
|
||||
},
|
||||
"puppeteer-cluster": {
|
||||
"version": "0.23.0",
|
||||
"resolved": "https://registry.npmjs.org/puppeteer-cluster/-/puppeteer-cluster-0.23.0.tgz",
|
||||
"integrity": "sha512-108terIWDzPrQopmoYSPd5yDoy3FGJ2dNnoGMkGYPs6xtkdhgaECwpfZkzaRToMQPZibUOz0/dSSGgPEdXEhkQ==",
|
||||
"requires": {
|
||||
"debug": "^4.3.3"
|
||||
}
|
||||
},
|
||||
"puppeteer-core": {
|
||||
"version": "18.2.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"cross-fetch": "3.1.5",
|
||||
"debug": "4.3.4",
|
||||
|
@ -2897,8 +3077,14 @@
|
|||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"rfdc": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz",
|
||||
"integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA=="
|
||||
},
|
||||
"rimraf": {
|
||||
"version": "3.0.2",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"glob": "^7.1.3"
|
||||
}
|
||||
|
@ -2962,6 +3148,28 @@
|
|||
"tweetnacl": "~0.14.0"
|
||||
}
|
||||
},
|
||||
"streamroller": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/streamroller/-/streamroller-3.1.3.tgz",
|
||||
"integrity": "sha512-CphIJyFx2SALGHeINanjFRKQ4l7x2c+rXYJ4BMq0gd+ZK0gi4VT8b+eHe2wi58x4UayBAKx4xtHpXT/ea1cz8w==",
|
||||
"requires": {
|
||||
"date-format": "^4.0.14",
|
||||
"debug": "^4.3.4",
|
||||
"fs-extra": "^8.1.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-extra": {
|
||||
"version": "8.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz",
|
||||
"integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==",
|
||||
"requires": {
|
||||
"graceful-fs": "^4.2.0",
|
||||
"jsonfile": "^4.0.0",
|
||||
"universalify": "^0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"strftime": {
|
||||
"version": "0.10.1"
|
||||
},
|
||||
|
@ -2996,6 +3204,7 @@
|
|||
},
|
||||
"tar-fs": {
|
||||
"version": "2.1.1",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"chownr": "^1.1.1",
|
||||
"mkdirp-classic": "^0.5.2",
|
||||
|
@ -3005,6 +3214,7 @@
|
|||
},
|
||||
"tar-stream": {
|
||||
"version": "2.2.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"bl": "^4.0.3",
|
||||
"end-of-stream": "^1.4.1",
|
||||
|
@ -3014,7 +3224,8 @@
|
|||
}
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8"
|
||||
"version": "2.3.8",
|
||||
"peer": true
|
||||
},
|
||||
"tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
|
@ -3024,7 +3235,8 @@
|
|||
}
|
||||
},
|
||||
"tr46": {
|
||||
"version": "0.0.3"
|
||||
"version": "0.0.3",
|
||||
"peer": true
|
||||
},
|
||||
"tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
|
@ -3037,6 +3249,7 @@
|
|||
},
|
||||
"unbzip2-stream": {
|
||||
"version": "1.4.3",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"buffer": "^5.2.1",
|
||||
"through": "^2.3.8"
|
||||
|
@ -3197,10 +3410,12 @@
|
|||
}
|
||||
},
|
||||
"webidl-conversions": {
|
||||
"version": "3.0.1"
|
||||
"version": "3.0.1",
|
||||
"peer": true
|
||||
},
|
||||
"whatwg-url": {
|
||||
"version": "5.0.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"tr46": "~0.0.3",
|
||||
"webidl-conversions": "^3.0.0"
|
||||
|
@ -3241,10 +3456,12 @@
|
|||
}
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.2"
|
||||
"version": "1.0.2",
|
||||
"peer": true
|
||||
},
|
||||
"ws": {
|
||||
"version": "8.9.0",
|
||||
"peer": true,
|
||||
"requires": {}
|
||||
},
|
||||
"xtend": {
|
||||
|
@ -3281,6 +3498,7 @@
|
|||
},
|
||||
"yauzl": {
|
||||
"version": "2.10.0",
|
||||
"peer": true,
|
||||
"requires": {
|
||||
"buffer-crc32": "~0.2.3",
|
||||
"fd-slicer": "~1.1.0"
|
||||
|
|
|
@ -18,9 +18,10 @@
|
|||
"js-yaml": "^3.13.1",
|
||||
"jsonexport": "^3.2.0",
|
||||
"juice": "^5.2.0",
|
||||
"log4js": "^6.7.0",
|
||||
"mysql2": "^1.7.0",
|
||||
"nodemailer": "^4.7.0",
|
||||
"puppeteer": "^18.0.5",
|
||||
"puppeteer-cluster": "^0.23.0",
|
||||
"qrcode": "^1.4.2",
|
||||
"strftime": "^0.10.0",
|
||||
"vue": "^2.6.10",
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = {
|
|||
},
|
||||
props: {
|
||||
id: {
|
||||
type: [Number, String],
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
from: {
|
||||
|
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
},
|
||||
props: {
|
||||
id: {
|
||||
type: [Number, String],
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ module.exports = {
|
|||
},
|
||||
props: {
|
||||
id: {
|
||||
type: [Number, String],
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
from: {
|
||||
|
|
|
@ -18,7 +18,7 @@ module.exports = {
|
|||
},
|
||||
props: {
|
||||
id: {
|
||||
type: [Number, String],
|
||||
type: Number,
|
||||
required: true
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue