Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into 1781-zoneHoliday
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
commit
a907354cc3
|
@ -62,13 +62,13 @@ pipeline {
|
|||
}
|
||||
}
|
||||
}
|
||||
// stage('Backend') {
|
||||
// steps {
|
||||
// nodejs('node-v14') {
|
||||
// sh 'gulp launchBackTest --ci'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
stage('Backend') {
|
||||
steps {
|
||||
nodejs('node-v14') {
|
||||
sh 'npm run test:back:ci'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Build') {
|
||||
|
|
|
@ -54,17 +54,17 @@ $ gulp docker
|
|||
|
||||
For client-side unit tests run from project's root.
|
||||
```
|
||||
$ jest
|
||||
$ npm run test:front
|
||||
```
|
||||
|
||||
For server-side unit tests run from project's root.
|
||||
```
|
||||
$ gulp backTest
|
||||
$ npm run test:back
|
||||
```
|
||||
|
||||
For end-to-end tests run from project's root.
|
||||
```
|
||||
$ gulp e2e
|
||||
$ npm run test:e2e
|
||||
```
|
||||
|
||||
## Visual Studio Code extensions
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
const {models} = require('vn-loopback/server/server');
|
||||
|
||||
describe('account changePassword()', () => {
|
||||
it('should throw an error when old password is wrong', async() => {
|
||||
let req = app.models.Account.changePassword(null, 1, 'wrongOldPass', 'newPass');
|
||||
let err;
|
||||
await models.Account.changePassword(1, 'wrongPassword', 'nightmare.9999')
|
||||
.catch(error => err = error.sqlMessage);
|
||||
|
||||
await expectAsync(req).toBeRejected();
|
||||
expect(err).toBeDefined();
|
||||
expect(err).toEqual('Invalid password');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module.exports = Self => {
|
||||
Self.remoteMethodCtx('setSaleQuantity', {
|
||||
Self.remoteMethod('setSaleQuantity', {
|
||||
description: 'Update sale quantity',
|
||||
accessType: 'WRITE',
|
||||
accepts: [{
|
||||
|
@ -24,11 +24,13 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.setSaleQuantity = async ctx => {
|
||||
const args = ctx.args;
|
||||
Self.setSaleQuantity = async(saleId, quantity) => {
|
||||
const models = Self.app.models;
|
||||
|
||||
const sale = await models.Sale.findById(args.saleId);
|
||||
return await sale.updateAttribute('quantity', args.quantity);
|
||||
const sale = await models.Sale.findById(saleId);
|
||||
return await sale.updateAttributes({
|
||||
originalQuantity: sale.quantity,
|
||||
quantity: quantity
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
const app = require('vn-loopback/server/server');
|
||||
|
||||
// #3400 analizar que hacer con rutas de back colletion
|
||||
xdescribe('newCollection()', () => {
|
||||
it('return a new collection', async() => {
|
||||
describe('newCollection()', () => {
|
||||
it('should return a new collection', async() => {
|
||||
pending('#3400 analizar que hacer con rutas de back collection');
|
||||
let ctx = {req: {accessToken: {userId: 1106}}};
|
||||
let response = await app.models.Collection.newCollection(ctx, 1, 1, 1);
|
||||
|
||||
|
|
|
@ -5,19 +5,12 @@ describe('setSaleQuantity()', () => {
|
|||
const saleId = 30;
|
||||
const newQuantity = 10;
|
||||
|
||||
const ctx = {
|
||||
args: {
|
||||
saleId: saleId,
|
||||
quantity: newQuantity
|
||||
}
|
||||
};
|
||||
|
||||
const originalSale = await models.Sale.findById(saleId);
|
||||
|
||||
await models.Collection.setSaleQuantity(ctx);
|
||||
await models.Collection.setSaleQuantity(saleId, newQuantity);
|
||||
const updateSale = await models.Sale.findById(saleId);
|
||||
|
||||
expect(updateSale.quantity).toBeLessThan(originalSale.quantity);
|
||||
expect(updateSale.originalQuantity).toEqual(originalSale.quantity);
|
||||
expect(updateSale.quantity).toEqual(newQuantity);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = Self => {
|
||||
Self.remoteMethod('deleteTrashFiles', {
|
||||
description: 'Deletes files that have trash type',
|
||||
accessType: 'WRITE',
|
||||
returns: {
|
||||
type: 'object',
|
||||
root: true
|
||||
},
|
||||
http: {
|
||||
path: `/deleteTrashFiles`,
|
||||
verb: 'POST'
|
||||
}
|
||||
});
|
||||
|
||||
Self.deleteTrashFiles = async(options) => {
|
||||
const tx = await Self.beginTransaction({});
|
||||
const myOptions = {};
|
||||
|
||||
if (typeof options == 'object')
|
||||
Object.assign(myOptions, options);
|
||||
|
||||
if (!myOptions.transaction)
|
||||
myOptions.transaction = tx;
|
||||
|
||||
try {
|
||||
const models = Self.app.models;
|
||||
const DmsContainer = models.DmsContainer;
|
||||
|
||||
const trashDmsType = await models.DmsType.findOne({
|
||||
where: {code: 'trash'}
|
||||
}, myOptions);
|
||||
|
||||
const dmsToDelete = await models.Dms.find({
|
||||
where: {
|
||||
dmsTypeFk: trashDmsType.id
|
||||
}
|
||||
}, myOptions);
|
||||
|
||||
for (let dms of dmsToDelete) {
|
||||
const pathHash = DmsContainer.getHash(dms.id);
|
||||
const dmsContainer = await DmsContainer.container(pathHash);
|
||||
const dstFile = path.join(dmsContainer.client.root, pathHash, dms.file);
|
||||
await fs.unlink(dstFile);
|
||||
await dms.destroy(myOptions);
|
||||
}
|
||||
if (tx) await tx.commit();
|
||||
|
||||
} catch (e) {
|
||||
if (tx) await tx.rollback();
|
||||
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
};
|
|
@ -68,6 +68,12 @@
|
|||
"Language": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MachineWorker": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"MobileAppVersionControl": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"Module": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
"type": "date"
|
||||
},
|
||||
"image": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
},
|
||||
"maxAmount": {
|
||||
"type": "number"
|
||||
},
|
||||
"daysInFuture": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"acls": [{
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"name": "MobileAppVersionControl",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "vn.mobileAppVersionControl"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"appName": {
|
||||
"type": "string"
|
||||
},
|
||||
"version": {
|
||||
"type": "string"
|
||||
},
|
||||
"isVersionCritical": {
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
|
|
|
@ -8,15 +8,15 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"bic": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -8,35 +8,35 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"bank": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"account": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"accountingTypeFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"mysql": {
|
||||
"columnName": "cash"
|
||||
}
|
||||
},
|
||||
"entityFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"isActive": {
|
||||
"type": "Boolean",
|
||||
"type": "boolean",
|
||||
"required": true
|
||||
},
|
||||
"currencyFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -10,20 +10,20 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"host": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"api": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"user": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"password": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [{
|
||||
|
|
|
@ -10,11 +10,11 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"code": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"expired": {
|
||||
"type": "date"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
|
@ -21,7 +21,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"isUeeMember": {
|
||||
"type": "Boolean"
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -9,17 +9,17 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"forceId": false
|
||||
},
|
||||
"date": {
|
||||
"type": "Date"
|
||||
"type": "date"
|
||||
},
|
||||
"m3":{
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"warehouseFk":{
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
|
|
|
@ -5,6 +5,7 @@ module.exports = Self => {
|
|||
require('../methods/dms/uploadFile')(Self);
|
||||
require('../methods/dms/removeFile')(Self);
|
||||
require('../methods/dms/updateFile')(Self);
|
||||
require('../methods/dms/deleteTrashFiles')(Self);
|
||||
|
||||
Self.checkRole = async function(ctx, id) {
|
||||
const models = Self.app.models;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
|
@ -36,7 +36,7 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
"created": {
|
||||
"type": "Date"
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"properties": {
|
||||
"userFk": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"email": {
|
||||
|
|
|
@ -8,20 +8,20 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"width": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"height": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"crop": {
|
||||
"type": "Boolean",
|
||||
"type": "boolean",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -8,32 +8,32 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"desc": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"maxWidth": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"maxHeight": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"model": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"property": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"name": "MachineWorker",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "vn.machineWorker"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"workerFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"machineFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"inTime": {
|
||||
"type": "date",
|
||||
"mysql": {
|
||||
"columnName": "inTimed"
|
||||
}
|
||||
},
|
||||
"outTime": {
|
||||
"type": "date",
|
||||
"mysql": {
|
||||
"columnName": "outTimed"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,7 +9,7 @@
|
|||
"properties": {
|
||||
"code": {
|
||||
"id": true,
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier",
|
||||
"mysql": {
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"name": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -9,18 +9,18 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"userFk": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"tableCode": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"configuration": {
|
||||
"type": "Object"
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -9,40 +9,40 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"forceId": false
|
||||
},
|
||||
"originFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"userFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"action": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"changedModel": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"oldInstance": {
|
||||
"type": "Object"
|
||||
"type": "object"
|
||||
},
|
||||
"newInstance": {
|
||||
"type": "Object"
|
||||
"type": "object"
|
||||
},
|
||||
"creationDate": {
|
||||
"type": "Date"
|
||||
"type": "date"
|
||||
},
|
||||
"changedModelId": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"changedModelValue": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"forceId": false
|
||||
},
|
||||
"username":{
|
||||
|
|
|
@ -10,17 +10,17 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"forceId": false
|
||||
},
|
||||
"name": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"code": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"isInventory": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"isManaged":{
|
||||
"type": "boolean"
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"verbose": true,
|
||||
"watch": [
|
||||
"back/**/*.js",
|
||||
"modules/**/*.js"
|
||||
],
|
||||
"ignore": [
|
||||
"modules/account/front/**/*",
|
||||
"modules/claim/front/**/*",
|
||||
"modules/client/front/**/*",
|
||||
"modules/entry/front/**/*",
|
||||
"modules/invoiceIn/front/**/*",
|
||||
"modules/invoiceOut/front/**/*",
|
||||
"modules/item/front/**/*",
|
||||
"modules/monitor/front/**/*",
|
||||
"modules/order/front/**/*",
|
||||
"modules/route/front/**/*",
|
||||
"modules/supplier/front/**/*",
|
||||
"modules/ticket/front/**/*",
|
||||
"modules/travel/front/**/*",
|
||||
"modules/worker/front/**/*",
|
||||
"modules/zone/front/**/*"
|
||||
]
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
require('require-yaml');
|
||||
const Docker = require('../db/docker.js');
|
||||
let dataSources = require('../loopback/server/datasources.json');
|
||||
|
||||
process.on('warning', warning => {
|
||||
console.log(warning.name);
|
||||
|
@ -6,34 +7,64 @@ process.on('warning', warning => {
|
|||
console.log(warning.stack);
|
||||
});
|
||||
|
||||
let verbose = false;
|
||||
async function test() {
|
||||
let isCI = false;
|
||||
|
||||
if (process.argv[2] === '--v')
|
||||
verbose = true;
|
||||
if (process.argv[2] === 'ci')
|
||||
isCI = true;
|
||||
|
||||
let Jasmine = require('jasmine');
|
||||
let jasmine = new Jasmine();
|
||||
let SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||
const container = new Docker();
|
||||
|
||||
let serviceSpecs = [
|
||||
`${__dirname}/**/*[sS]pec.js`,
|
||||
`${__dirname}/../loopback/**/*[sS]pec.js`,
|
||||
`${__dirname}/../modules/*/back/**/*.[sS]pec.js`
|
||||
];
|
||||
await container.run(isCI);
|
||||
dataSources = JSON.parse(JSON.stringify(dataSources));
|
||||
|
||||
jasmine.loadConfig({
|
||||
spec_dir: '.',
|
||||
spec_files: serviceSpecs,
|
||||
helpers: []
|
||||
});
|
||||
Object.assign(dataSources.vn, {
|
||||
host: container.dbConf.host,
|
||||
port: container.dbConf.port
|
||||
});
|
||||
|
||||
jasmine.addReporter(new SpecReporter({
|
||||
spec: {
|
||||
// displayStacktrace: 'summary',
|
||||
displaySuccessful: verbose,
|
||||
displayFailedSpec: true,
|
||||
displaySpecDuration: true
|
||||
const bootOptions = {dataSources};
|
||||
const app = require('vn-loopback/server/server');
|
||||
app.boot(bootOptions);
|
||||
|
||||
const Jasmine = require('jasmine');
|
||||
const jasmine = new Jasmine();
|
||||
|
||||
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||
jasmine.addReporter(new SpecReporter({
|
||||
spec: {
|
||||
displaySuccessful: isCI,
|
||||
displayPending: isCI
|
||||
},
|
||||
summary: {
|
||||
displayPending: false,
|
||||
}
|
||||
}));
|
||||
|
||||
if (isCI) {
|
||||
const JunitReporter = require('jasmine-reporters');
|
||||
jasmine.addReporter(new JunitReporter.JUnitXmlReporter());
|
||||
|
||||
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
|
||||
}
|
||||
}));
|
||||
|
||||
jasmine.execute();
|
||||
const backSpecs = [
|
||||
'./back/**/*[sS]pec.js',
|
||||
'./loopback/**/*[sS]pec.js',
|
||||
'./modules/*/back/**/*.[sS]pec.js'
|
||||
];
|
||||
|
||||
jasmine.loadConfig({
|
||||
spec_dir: '.',
|
||||
spec_files: backSpecs,
|
||||
helpers: [],
|
||||
});
|
||||
|
||||
jasmine.exitOnCompletion = false;
|
||||
await jasmine.execute();
|
||||
if (app) await app.disconnect();
|
||||
if (container) await container.rm();
|
||||
console.log('app disconnected & container removed');
|
||||
}
|
||||
|
||||
test();
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('ExpeditionState', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
|
@ -0,0 +1,5 @@
|
|||
INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('Expense', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||
|
||||
INSERT INTO `salix`.`ACL`(`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('Expense', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -0,0 +1,5 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('SupplierActivity', '*', 'READ', 'ALLOW', 'ROLE', 'employee');
|
||||
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('SupplierActivity', '*', 'WRITE', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -1,14 +0,0 @@
|
|||
create table `vn`.`invoiceOut_queue`
|
||||
(
|
||||
invoiceFk int(10) unsigned not null,
|
||||
queued datetime default now() not null,
|
||||
printed datetime null,
|
||||
`status` VARCHAR(50) default '' null,
|
||||
constraint invoiceOut_queue_pk
|
||||
primary key (invoiceFk),
|
||||
constraint invoiceOut_queue_invoiceOut_id_fk
|
||||
foreign key (invoiceFk) references invoiceOut (id)
|
||||
on update cascade on delete cascade
|
||||
)
|
||||
comment 'Queue for PDF invoicing';
|
||||
|
|
@ -2,49 +2,64 @@ DROP PROCEDURE IF EXISTS vn.ticket_doRefund;
|
|||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doRefund`(IN vOriginTicket INT, OUT vNewTicket INT)
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ticket_doRefund`(OUT vNewTicket INT)
|
||||
BEGIN
|
||||
|
||||
/**
|
||||
* Crea un ticket de abono a partir de tmp.sale y/o tmp.ticketService
|
||||
*
|
||||
* @return vNewTicket
|
||||
*/
|
||||
DECLARE vDone BIT DEFAULT 0;
|
||||
DECLARE vCustomer MEDIUMINT;
|
||||
DECLARE vClientFk MEDIUMINT;
|
||||
DECLARE vWarehouse TINYINT;
|
||||
DECLARE vCompany MEDIUMINT;
|
||||
DECLARE vAddress MEDIUMINT;
|
||||
DECLARE vRefundAgencyMode INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vQuantity DECIMAL (10,2);
|
||||
DECLARE vConcept VARCHAR(50);
|
||||
DECLARE vPrice DECIMAL (10,2);
|
||||
DECLARE vDiscount TINYINT;
|
||||
DECLARE vRefundAgencyMode INT;
|
||||
DECLARE vItemFk INT;
|
||||
DECLARE vQuantity DECIMAL (10,2);
|
||||
DECLARE vConcept VARCHAR(50);
|
||||
DECLARE vPrice DECIMAL (10,2);
|
||||
DECLARE vDiscount TINYINT;
|
||||
DECLARE vSaleNew INT;
|
||||
DECLARE vSaleMain INT;
|
||||
DECLARE vZoneFk INT;
|
||||
DECLARE vDescription VARCHAR(50);
|
||||
DECLARE vTaxClassFk INT;
|
||||
DECLARE vTicketServiceTypeFk INT;
|
||||
|
||||
DECLARE cSales CURSOR FOR
|
||||
SELECT *
|
||||
FROM tmp.sale;
|
||||
|
||||
DECLARE vSaleMain INT;
|
||||
DECLARE vZoneFk INT;
|
||||
DECLARE vDescription VARCHAR(50);
|
||||
DECLARE vTaxClassFk INT;
|
||||
DECLARE vTicketServiceTypeFk INT;
|
||||
DECLARE vOriginTicket INT;
|
||||
|
||||
DECLARE cSales CURSOR FOR
|
||||
SELECT s.id, s.itemFk, - s.quantity, s.concept, s.price, s.discount
|
||||
FROM tmp.sale s;
|
||||
|
||||
DECLARE cTicketServices CURSOR FOR
|
||||
SELECT *
|
||||
FROM tmp.ticketService;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = 1;
|
||||
|
||||
SELECT id INTO vRefundAgencyMode
|
||||
SELECT ts.description, - ts.quantity, ts.price, ts.taxClassFk, ts.ticketServiceTypeFk
|
||||
FROM tmp.ticketService ts;
|
||||
|
||||
DECLARE CONTINUE HANDLER FOR NOT FOUND SET vDone = TRUE;
|
||||
|
||||
SELECT sub.ticketFk INTO vOriginTicket
|
||||
FROM (
|
||||
SELECT s.ticketFk
|
||||
FROM tmp.sale s
|
||||
UNION ALL
|
||||
SELECT ts.ticketFk
|
||||
FROM tmp.ticketService ts
|
||||
) sub
|
||||
LIMIT 1;
|
||||
|
||||
SELECT id INTO vRefundAgencyMode
|
||||
FROM agencyMode WHERE `name` = 'ABONO';
|
||||
|
||||
SELECT clientFk, warehouseFk, companyFk, addressFk
|
||||
INTO vCustomer, vWarehouse, vCompany, vAddress
|
||||
FROM ticket
|
||||
WHERE id = vOriginTicket;
|
||||
|
||||
SELECT id INTO vZoneFk
|
||||
INTO vClientFk, vWarehouse, vCompany, vAddress
|
||||
FROM ticket
|
||||
WHERE id = vOriginTicket;
|
||||
|
||||
SELECT id INTO vZoneFk
|
||||
FROM zone WHERE agencyModeFk = vRefundAgencyMode
|
||||
LIMIT 1;
|
||||
|
||||
LIMIT 1;
|
||||
|
||||
INSERT INTO vn.ticket (
|
||||
clientFk,
|
||||
shipped,
|
||||
|
@ -54,10 +69,10 @@ BEGIN
|
|||
warehouseFk,
|
||||
companyFk,
|
||||
landed,
|
||||
zoneFk
|
||||
zoneFk
|
||||
)
|
||||
SELECT
|
||||
vCustomer,
|
||||
vClientFk,
|
||||
CURDATE(),
|
||||
vAddress,
|
||||
vRefundAgencyMode,
|
||||
|
@ -65,49 +80,48 @@ BEGIN
|
|||
vWarehouse,
|
||||
vCompany,
|
||||
CURDATE(),
|
||||
vZoneFk
|
||||
vZoneFk
|
||||
FROM address a
|
||||
WHERE a.id = vAddress;
|
||||
|
||||
SET vNewTicket = LAST_INSERT_ID();
|
||||
|
||||
SET vDone := 0;
|
||||
SET vDone := FALSE;
|
||||
OPEN cSales;
|
||||
FETCH cSales INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount;
|
||||
FETCH cSales INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount;
|
||||
|
||||
WHILE NOT vDone DO
|
||||
|
||||
|
||||
INSERT INTO vn.sale(ticketFk, itemFk, quantity, concept, price, discount)
|
||||
VALUES( vNewTicket, vItemFk, vQuantity, vConcept, vPrice, vDiscount );
|
||||
|
||||
SET vSaleNew = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO vn.saleComponent(saleFk,componentFk,`value`)
|
||||
SELECT vSaleNew,componentFk,`value`
|
||||
FROM vn.saleComponent
|
||||
WHERE saleFk = vSaleMain;
|
||||
|
||||
|
||||
SET vSaleNew = LAST_INSERT_ID();
|
||||
|
||||
INSERT INTO vn.saleComponent(saleFk,componentFk,`value`)
|
||||
SELECT vSaleNew,componentFk,`value`
|
||||
FROM vn.saleComponent
|
||||
WHERE saleFk = vSaleMain;
|
||||
|
||||
FETCH cSales INTO vSaleMain, vItemFk, vQuantity, vConcept, vPrice, vDiscount;
|
||||
|
||||
|
||||
END WHILE;
|
||||
CLOSE cSales;
|
||||
|
||||
SET vDone := 0;
|
||||
SET vDone := FALSE;
|
||||
OPEN cTicketServices;
|
||||
FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk;
|
||||
FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk;
|
||||
|
||||
WHILE NOT vDone DO
|
||||
|
||||
|
||||
INSERT INTO vn.ticketService(description, quantity, price, taxClassFk, ticketFk, ticketServiceTypeFk)
|
||||
VALUES(vDescription, vQuantity, vPrice, vTaxClassFk, vNewTicket, vTicketServiceTypeFk);
|
||||
|
||||
|
||||
FETCH cTicketServices INTO vDescription, vQuantity, vPrice, vTaxClassFk, vTicketServiceTypeFk;
|
||||
|
||||
|
||||
END WHILE;
|
||||
CLOSE cTicketServices;
|
||||
|
||||
INSERT INTO vn.ticketRefund(refundTicketFk, originalTicketFk)
|
||||
VALUES(vNewTicket, vOriginTicket);
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE `vn`.`clientConfig` ADD `maxCreditRows` int(11) NULL COMMENT 'Máximo número de registros a mantener en la tabla clientCredit';
|
||||
|
||||
UPDATE `vn`.`clientConfig`
|
||||
SET `maxCreditRows` = 10
|
||||
WHERE `id` = 1;
|
|
@ -0,0 +1,8 @@
|
|||
ALTER TABLE `vn`.`propertyDms` DROP FOREIGN KEY propertyDms_FK;
|
||||
ALTER TABLE `vn`.`propertyDms` ADD CONSTRAINT propertyDms_FK FOREIGN KEY (dmsFk) REFERENCES `vn`.`dms`(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `vn`.`clientDms` DROP FOREIGN KEY clientDms_ibfk_2;
|
||||
ALTER TABLE `vn`.`clientDms` ADD CONSTRAINT clientDms_ibfk_2 FOREIGN KEY (dmsFk) REFERENCES `vn`.`dms`(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE `vn`.`workerDocument` DROP FOREIGN KEY workerDocument_ibfk_2;
|
||||
ALTER TABLE `vn`.`workerDocument` ADD CONSTRAINT workerDocument_ibfk_2 FOREIGN KEY (document) REFERENCES `vn`.`dms`(id) ON DELETE CASCADE ON UPDATE CASCADE;
|
|
@ -0,0 +1,5 @@
|
|||
ALTER TABLE `vn`.`dmsType` ADD monthToDelete INT UNSIGNED DEFAULT NULL NULL;
|
||||
ALTER TABLE `vn`.`dmsType` MODIFY COLUMN monthToDelete int(10) unsigned DEFAULT NULL NULL COMMENT 'Meses en el pasado para ir borrando registros, dejar a null para no borrarlos nunca';
|
||||
UPDATE `vn`.`dmsType`
|
||||
SET monthToDelete=6
|
||||
WHERE id=20;
|
|
@ -0,0 +1,18 @@
|
|||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE TRIGGER `vn`.`dms_beforeDelete`
|
||||
BEFORE DELETE
|
||||
ON dms FOR EACH ROW
|
||||
BEGIN
|
||||
DECLARE vCanNotBeDeleted INT;
|
||||
SELECT COUNT(*) INTO vCanNotBeDeleted
|
||||
FROM dmsType dt
|
||||
WHERE NOT (code <=> 'trash')
|
||||
AND dt.id = OLD.dmsTypeFk;
|
||||
|
||||
IF vCanNotBeDeleted THEN
|
||||
CALL util.throw('A dms can not be deleted');
|
||||
END IF;
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,175 @@
|
|||
DROP PROCEDURE IF EXISTS vn.clean;
|
||||
|
||||
DELIMITER $$
|
||||
$$
|
||||
CREATE DEFINER=`root`@`localhost` PROCEDURE `vn`.`clean`()
|
||||
BEGIN
|
||||
DECLARE vDateShort DATETIME;
|
||||
DECLARE vOneYearAgo DATE;
|
||||
DECLARE vFourYearsAgo DATE;
|
||||
DECLARE v18Month DATE;
|
||||
DECLARE v26Month DATE;
|
||||
DECLARE v3Month DATE;
|
||||
DECLARE vTrashId varchar(15);
|
||||
|
||||
SET vDateShort = TIMESTAMPADD(MONTH, -2, CURDATE());
|
||||
SET vOneYearAgo = TIMESTAMPADD(YEAR,-1,CURDATE());
|
||||
SET vFourYearsAgo = TIMESTAMPADD(YEAR,-4,CURDATE());
|
||||
SET v18Month = TIMESTAMPADD(MONTH, -18,CURDATE());
|
||||
SET v26Month = TIMESTAMPADD(MONTH, -26,CURDATE());
|
||||
SET v3Month = TIMESTAMPADD(MONTH, -3, CURDATE());
|
||||
|
||||
DELETE FROM ticketParking WHERE created < vDateShort;
|
||||
DELETE FROM routesMonitor WHERE dated < vDateShort;
|
||||
DELETE FROM workerTimeControlLog WHERE created < vDateShort;
|
||||
DELETE FROM `message` WHERE sendDate < vDateShort;
|
||||
DELETE FROM messageInbox WHERE sendDate < vDateShort;
|
||||
DELETE FROM messageInbox WHERE sendDate < vDateShort;
|
||||
DELETE FROM workerTimeControl WHERE timed < vFourYearsAgo;
|
||||
DELETE FROM itemShelving WHERE created < CURDATE() AND visible = 0;
|
||||
DELETE FROM ticketDown WHERE created < TIMESTAMPADD(DAY,-1,CURDATE());
|
||||
DELETE FROM entryLog WHERE creationDate < vDateShort;
|
||||
DELETE IGNORE FROM expedition WHERE created < v26Month;
|
||||
DELETE FROM sms WHERE created < v18Month;
|
||||
DELETE FROM saleTracking WHERE created < vOneYearAgo;
|
||||
DELETE tobs FROM ticketObservation tobs
|
||||
JOIN ticket t ON tobs.ticketFk = t.id WHERE t.shipped < TIMESTAMPADD(YEAR,-2,CURDATE());
|
||||
DELETE sc.* FROM saleCloned sc JOIN sale s ON s.id = sc.saleClonedFk JOIN ticket t ON t.id = s.ticketFk WHERE t.shipped < vOneYearAgo;
|
||||
DELETE FROM sharingCart where ended < vDateShort;
|
||||
DELETE FROM sharingClient where ended < vDateShort;
|
||||
DELETE tw.* FROM ticketWeekly tw
|
||||
LEFT JOIN sale s ON s.ticketFk = tw.ticketFk WHERE s.itemFk IS NULL;
|
||||
DELETE FROM claim WHERE ticketCreated < vFourYearsAgo;
|
||||
DELETE FROM message WHERE sendDate < vDateShort;
|
||||
-- Robert ubicacion anterior de trevelLog comentario para debug
|
||||
DELETE sc FROM saleChecked sc
|
||||
JOIN sale s ON sc.saleFk = s.id WHERE s.created < vDateShort;
|
||||
DELETE FROM zoneEvent WHERE `type` = 'day' AND dated < v3Month;
|
||||
DELETE bm
|
||||
FROM buyMark bm
|
||||
JOIN buy b ON b.id = bm.id
|
||||
JOIN entry e ON e.id = b.entryFk
|
||||
JOIN travel t ON t.id = e.travelFk
|
||||
WHERE t.landed <= vDateShort;
|
||||
DELETE FROM stowaway WHERE created < v3Month;
|
||||
DELETE FROM vn.buy WHERE created < vDateShort AND entryFk = 9200;
|
||||
DELETE FROM vn.itemShelvingLog WHERE created < vDateShort;
|
||||
DELETE FROM vn.stockBuyed WHERE creationDate < vDateShort;
|
||||
|
||||
|
||||
-- Equipos duplicados
|
||||
DELETE w.*
|
||||
FROM workerTeam w
|
||||
JOIN (SELECT id, team, workerFk, COUNT(*) - 1 as duplicated
|
||||
FROM workerTeam
|
||||
GROUP BY team,workerFk
|
||||
HAVING duplicated
|
||||
) d ON d.team = w.team AND d.workerFk = w.workerFk AND d.id != w.id;
|
||||
|
||||
DELETE sc
|
||||
FROM saleComponent sc
|
||||
JOIN sale s ON s.id= sc.saleFk
|
||||
JOIN ticket t ON t.id= s.ticketFk
|
||||
WHERE t.shipped < v18Month;
|
||||
|
||||
DELETE c
|
||||
FROM vn.claim c
|
||||
JOIN vn.claimState cs ON cs.id = c.claimStateFk
|
||||
WHERE cs.description = "Anulado" AND
|
||||
c.created < vDateShort;
|
||||
DELETE
|
||||
FROM vn.expeditionTruck
|
||||
WHERE ETD < v3Month;
|
||||
|
||||
-- borrar travels sin entradas
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.thermographToDelete
|
||||
SELECT th.id,th.dmsFk
|
||||
FROM vn.travel t
|
||||
LEFT JOIN vn.entry e ON e.travelFk = t.id
|
||||
JOIN vn.travelThermograph th ON th.travelFk = t.id
|
||||
WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL;
|
||||
|
||||
SELECT dt.id into vTrashId
|
||||
FROM vn.dmsType dt
|
||||
WHERE dt.code = 'trash';
|
||||
|
||||
UPDATE tmp.thermographToDelete th
|
||||
JOIN vn.dms d ON d.id = th.dmsFk
|
||||
SET d.dmsTypeFk = vTrashId;
|
||||
|
||||
DELETE th
|
||||
FROM tmp.thermographToDelete tmp
|
||||
JOIN vn.travelThermograph th ON th.id = tmp.id;
|
||||
|
||||
DELETE t
|
||||
FROM vn.travel t
|
||||
LEFT JOIN vn.entry e ON e.travelFk = t.id
|
||||
WHERE t.shipped < TIMESTAMPADD(MONTH, -3, CURDATE()) AND e.travelFk IS NULL;
|
||||
|
||||
UPDATE dms d
|
||||
JOIN dmsType dt ON dt.id = d.dmsTypeFk
|
||||
SET d.dmsTypeFk = vTrashId
|
||||
WHERE created < TIMESTAMPADD(MONTH, -dt.monthToDelete, CURDATE());
|
||||
|
||||
-- borrar entradas sin compras
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.entryToDelete
|
||||
SELECT e.*
|
||||
FROM vn.entry e
|
||||
LEFT JOIN vn.buy b ON b.entryFk = e.id
|
||||
JOIN vn.entryConfig ec ON e.id != ec.defaultEntry
|
||||
WHERE e.dated < TIMESTAMPADD(MONTH, -3, CURDATE()) AND b.entryFK IS NULL;
|
||||
|
||||
DELETE e
|
||||
FROM vn.entry e
|
||||
JOIN tmp.entryToDelete tmp ON tmp.id = e.id;
|
||||
|
||||
-- borrar de route registros menores a 4 años
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.routeToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.routeToDelete
|
||||
SELECT *
|
||||
FROM vn.route r
|
||||
WHERE created < TIMESTAMPADD(YEAR,-4,CURDATE());
|
||||
|
||||
UPDATE tmp.routeToDelete tmp
|
||||
JOIN vn.dms d ON d.id = tmp.gestdocFk
|
||||
SET d.dmsTypeFk = vTrashId;
|
||||
|
||||
DELETE r
|
||||
FROM tmp.routeToDelete tmp
|
||||
JOIN vn.route r ON r.id = tmp.id;
|
||||
|
||||
-- borrar registros de dua y awb menores a 2 años
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete;
|
||||
CREATE TEMPORARY TABLE tmp.duaToDelete
|
||||
SELECT *
|
||||
FROM vn.dua
|
||||
WHERE operated < TIMESTAMPADD(YEAR,-2,CURDATE());
|
||||
|
||||
UPDATE tmp.duaToDelete tm
|
||||
JOIN vn.dms d ON d.id = tm.gestdocFk
|
||||
SET d.dmsTypeFk = vTrashId;
|
||||
|
||||
DELETE d
|
||||
FROM tmp.duaToDelete tmp
|
||||
JOIN vn.dua d ON d.id = tmp.id;
|
||||
|
||||
DELETE FROM vn.awb WHERE created < TIMESTAMPADD(YEAR,-2,CURDATE());
|
||||
|
||||
-- Borra los ficheros gestDoc
|
||||
INSERT INTO vn.printServerQueue(priorityFk, labelReportFk)VALUES(1,11);
|
||||
|
||||
-- Borra los registros de collection y ticketcollection
|
||||
DELETE FROM vn.collection WHERE created < vDateShort;
|
||||
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.thermographToDelete;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.entryToDelete;
|
||||
DROP TEMPORARY TABLE IF EXISTS tmp.duaToDelete;
|
||||
|
||||
DELETE FROM travelLog WHERE creationDate < v3Month;
|
||||
|
||||
CALL shelving_clean;
|
||||
|
||||
END$$
|
||||
DELIMITER ;
|
|
@ -0,0 +1,2 @@
|
|||
INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId)
|
||||
VALUES ('Dms','deleteTrashFiles','WRITE','ALLOW','ROLE','employee')
|
|
@ -0,0 +1,4 @@
|
|||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES
|
||||
('ItemType', '*', 'READ', 'ALLOW', 'ROLE', 'employee'),
|
||||
('ItemType', '*', 'WRITE', 'ALLOW', 'ROLE', 'buyer');
|
|
@ -1 +0,0 @@
|
|||
Delete file
|
|
@ -3,8 +3,8 @@ CREATE TABLE `vn`.`clientUnpaid` (
|
|||
`dated` date NOT NULL,
|
||||
`amount` double DEFAULT 0,
|
||||
PRIMARY KEY (`clientFk`),
|
||||
CONSTRAINT `clientUnpaid_clientFk` FOREIGN KEY (`clientFk`) REFERENCES `client` (`id`) ON UPDATE CASCADE
|
||||
CONSTRAINT `clientUnpaid_clientFk` FOREIGN KEY (`clientFk`) REFERENCES `vn`.`client` (`id`) ON UPDATE CASCADE
|
||||
);
|
||||
|
||||
INSERT INTO `salix`.`ACL` (`model`, `property`, `accessType`, `permission`, `principalType`, `principalId`)
|
||||
VALUES('ClientUnpaid', '*', '*', 'ALLOW', 'ROLE', 'administrative');
|
||||
VALUES('ClientUnpaid', '*', '*', 'ALLOW', 'ROLE', 'administrative');
|
|
@ -0,0 +1,8 @@
|
|||
CREATE TABLE `vn`.`invoiceOut_queue` (
|
||||
`invoiceFk` int(10) unsigned not null,
|
||||
`queued` datetime default now() not null,
|
||||
`printed` datetime null,
|
||||
`status` VARCHAR(50) DEFAULT '' NULL,
|
||||
CONSTRAINT `invoiceOut_queue_pk` PRIMARY KEY (`invoiceFk`),
|
||||
CONSTRAINT `invoiceOut_queue_invoiceOut_id_fk` FOREIGN KEY (`invoiceFk`) REFERENCES `vn`.`invoiceOut` (`id`) ON UPDATE CASCADE ON DELETE CASCADE
|
||||
) comment 'Queue for PDF invoicing';
|
|
@ -0,0 +1,2 @@
|
|||
ALTER TABLE `vn`.`accountingType` ADD daysInFuture INT NULL;
|
||||
ALTER TABLE `vn`.`accountingType` MODIFY COLUMN daysInFuture int(11) DEFAULT 0 NULL;
|
|
@ -24,7 +24,10 @@ module.exports = class Docker {
|
|||
let d = new Date();
|
||||
let pad = v => v < 10 ? '0' + v : v;
|
||||
let stamp = `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;
|
||||
|
||||
log('Building container image...');
|
||||
await this.execP(`docker build --build-arg STAMP=${stamp} -t salix-db ./db`);
|
||||
log('Image built.');
|
||||
|
||||
let dockerArgs;
|
||||
|
||||
|
@ -39,6 +42,7 @@ module.exports = class Docker {
|
|||
|
||||
let runChown = process.platform != 'linux';
|
||||
|
||||
log('Starting container...');
|
||||
const container = await this.execP(`docker run --env RUN_CHOWN=${runChown} -d ${dockerArgs} salix-db`);
|
||||
this.id = container.stdout.trim();
|
||||
|
||||
|
@ -158,6 +162,7 @@ module.exports = class Docker {
|
|||
return reject(new Error('Docker exited, please see the docker logs for more info'));
|
||||
|
||||
let conn = mysql.createConnection(myConf);
|
||||
|
||||
conn.on('error', () => {});
|
||||
conn.connect(err => {
|
||||
conn.destroy();
|
||||
|
|
|
@ -99,13 +99,19 @@ INSERT INTO `account`.`mailForward`(`account`, `forwardTo`)
|
|||
VALUES
|
||||
(1, 'employee@domain.local');
|
||||
|
||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`)
|
||||
INSERT INTO `vn`.`printer` (`id`, `name`, `path`, `isLabeler`)
|
||||
VALUES
|
||||
(1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106),
|
||||
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107),
|
||||
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108),
|
||||
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109),
|
||||
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110);
|
||||
(1, 'printer1', 'path1', 0),
|
||||
(2, 'printer2', 'path2', 1);
|
||||
|
||||
|
||||
INSERT INTO `vn`.`worker`(`id`, `code`, `firstName`, `lastName`, `userFk`,`bossFk`, `phone`, `sectorFk`, `labelerFk`)
|
||||
VALUES
|
||||
(1106, 'LGN', 'David Charles', 'Haller', 1106, 19, 432978106, NULL, NULL),
|
||||
(1107, 'ANT', 'Hank' , 'Pym' , 1107, 19, 432978107, NULL, 1),
|
||||
(1108, 'DCX', 'Charles' , 'Xavier', 1108, 19, 432978108, 1, NULL),
|
||||
(1109, 'HLK', 'Bruce' , 'Banner', 1109, 19, 432978109, 1, 2),
|
||||
(1110, 'JJJ', 'Jessica' , 'Jones' , 1110, 19, 432978110, 2, 1);
|
||||
|
||||
INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
||||
VALUES
|
||||
|
@ -113,7 +119,7 @@ INSERT INTO `vn`.`currency`(`id`, `code`, `name`, `ratio`)
|
|||
(2, 'USD', 'Dollar USA', 1.4),
|
||||
(3, 'GBP', 'Libra', 1),
|
||||
(4, 'JPY', 'Yen Japones', 1);
|
||||
|
||||
|
||||
INSERT INTO `vn`.`country`(`id`, `country`, `isUeeMember`, `code`, `currencyFk`, `ibanLength`, `continentFk`, `hasDailyInvoice`, `CEE`)
|
||||
VALUES
|
||||
(1, 'España', 1, 'ES', 1, 24, 4, 0, 1),
|
||||
|
@ -156,22 +162,23 @@ INSERT INTO `vn`.`shelving` (`code`, `parkingFk`, `isPrinted`, `priority`, `park
|
|||
('HEJ', 2, 0, 1, 0, 1106),
|
||||
('UXN', 1, 0, 1, 0, 1106);
|
||||
|
||||
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`)
|
||||
INSERT INTO `vn`.`accountingType`(`id`, `description`, `receiptDescription`,`code`, `maxAmount`, `daysInFuture`)
|
||||
VALUES
|
||||
(1, 'CC y Polizas de crédito', NULL, NULL, NULL),
|
||||
(2, 'Cash', 'Cash', 'cash', 1000),
|
||||
(3, 'Credit card', 'Credit Card', 'creditCard', NULL),
|
||||
(4, 'Finalcial lines', NULL, NULL, NULL),
|
||||
(5, 'Other products', NULL, NULL, NULL),
|
||||
(6, 'Loans', NULL, NULL, NULL),
|
||||
(7, 'Leasing', NULL, NULL, NULL),
|
||||
(8, 'Compensations', 'Compensations', 'compensation', NULL);
|
||||
(1, 'CC and credit policies', 'Transfers', 'wireTransfer', NULL, 1),
|
||||
(2, 'Cash', 'Cash', 'cash', 1000, 0),
|
||||
(3, 'Credit card', 'Credit Card', 'creditCard', NULL, 0),
|
||||
(4, 'Finalcial lines', NULL, NULL, NULL, 0),
|
||||
(5, 'Other products', NULL, NULL, NULL, 0),
|
||||
(6, 'Loans', NULL, NULL, NULL, 0),
|
||||
(7, 'Leasing', NULL, NULL, NULL, 0),
|
||||
(8, 'Compensations', 'Compensations', 'compensation', NULL, 0);
|
||||
|
||||
INSERT INTO `vn`.`bank`(`id`, `bank`, `account`, `cash`, `entityFk`, `isActive`, `currencyFk`)
|
||||
VALUES
|
||||
(1, 'Pay on receipt', '5720000001', 3, 0, 1, 1),
|
||||
(2, 'Cash', '5700000001', 2, 0, 1, 1),
|
||||
(3, 'Compensation', '4000000000', 8, 0, 1, 1),
|
||||
(4, 'Transfers', '4000000001', 1, 0, 1, 1),
|
||||
(3117, 'Caixa Rural d''Algemesi', '5720000000', 8, 3117, 1, 1);
|
||||
|
||||
|
||||
|
@ -313,9 +320,9 @@ INSERT INTO `vn`.`clientManaCache`(`clientFk`, `mana`, `dated`)
|
|||
(1103, 0, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(1104, -30, DATE_ADD(CURDATE(), INTERVAL -1 MONTH));
|
||||
|
||||
INSERT INTO `vn`.`clientConfig`(`riskTolerance`)
|
||||
INSERT INTO `vn`.`clientConfig`(`riskTolerance`, `maxCreditRows`)
|
||||
VALUES
|
||||
(200);
|
||||
(200, 10);
|
||||
|
||||
INSERT INTO `vn`.`address`(`id`, `nickname`, `street`, `city`, `postalCode`, `provinceFk`, `phone`, `mobile`, `isActive`, `clientFk`, `agencyModeFk`, `longitude`, `latitude`, `isEqualizated`, `isDefaultAddress`)
|
||||
VALUES
|
||||
|
@ -393,17 +400,17 @@ DROP TEMPORARY TABLE tmp.address;
|
|||
|
||||
INSERT INTO `vn`.`clientCredit`(`id`, `clientFk`, `workerFk`, `amount`, `created`)
|
||||
VALUES
|
||||
(1 , 1101, 5, 300, DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(2 , 1101, 5, 900, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
(3 , 1101, 5, 800, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
||||
(4 , 1101, 5, 700, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
|
||||
(5 , 1101, 5, 600, DATE_ADD(CURDATE(), INTERVAL -5 MONTH)),
|
||||
(1 , 1101, 5, 300, DATE_ADD(CURDATE(), INTERVAL -11 MONTH)),
|
||||
(2 , 1101, 5, 900, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)),
|
||||
(3 , 1101, 5, 800, DATE_ADD(CURDATE(), INTERVAL -9 MONTH)),
|
||||
(4 , 1101, 5, 700, DATE_ADD(CURDATE(), INTERVAL -8 MONTH)),
|
||||
(5 , 1101, 5, 600, DATE_ADD(CURDATE(), INTERVAL -7 MONTH)),
|
||||
(6 , 1101, 5, 500, DATE_ADD(CURDATE(), INTERVAL -6 MONTH)),
|
||||
(7 , 1101, 5, 400, DATE_ADD(CURDATE(), INTERVAL -7 MONTH)),
|
||||
(8 , 1101, 9, 300, DATE_ADD(CURDATE(), INTERVAL -8 MONTH)),
|
||||
(9 , 1101, 9, 200, DATE_ADD(CURDATE(), INTERVAL -9 MONTH)),
|
||||
(10, 1101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -10 MONTH)),
|
||||
(11, 1101, 9, 50 , DATE_ADD(CURDATE(), INTERVAL -11 MONTH)),
|
||||
(7 , 1101, 5, 400, DATE_ADD(CURDATE(), INTERVAL -5 MONTH)),
|
||||
(8 , 1101, 9, 300, DATE_ADD(CURDATE(), INTERVAL -4 MONTH)),
|
||||
(9 , 1101, 9, 200, DATE_ADD(CURDATE(), INTERVAL -3 MONTH)),
|
||||
(10, 1101, 9, 100, DATE_ADD(CURDATE(), INTERVAL -2 MONTH)),
|
||||
(11, 1101, 9, 50 , DATE_ADD(CURDATE(), INTERVAL -1 MONTH)),
|
||||
(12, 1102, 9, 800, CURDATE()),
|
||||
(14, 1104, 9, 90 , CURDATE()),
|
||||
(15, 1105, 9, 90 , CURDATE());
|
||||
|
@ -744,14 +751,19 @@ INSERT INTO `vn`.`itemCategory`(`id`, `name`, `display`, `color`, `icon`, `code`
|
|||
(7, 'Accessories', 1, NULL, 'icon-accessory', 'accessory'),
|
||||
(8, 'Fruit', 1, NULL, 'icon-fruit', 'fruit');
|
||||
|
||||
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `warehouseFk`, `life`,`workerFk`, `isPackaging`)
|
||||
INSERT INTO `vn`.`temperature`(`code`, `name`, `description`)
|
||||
VALUES
|
||||
(1, 'CRI', 'Crisantemo', 2, 1, 31, 35, 0),
|
||||
(2, 'ITG', 'Anthurium', 1, 1, 31, 35, 0),
|
||||
(3, 'WPN', 'Paniculata', 2, 1, 31, 35, 0),
|
||||
(4, 'PRT', 'Delivery ports', 3, 1, NULL, 35, 1),
|
||||
(5, 'CON', 'Container', 3, 1, NULL, 35, 1),
|
||||
(6, 'ALS', 'Alstroemeria', 1, 1, 31, 16, 0);
|
||||
('warm', 'Warm', 'Warm'),
|
||||
('cool', 'Cool', 'Cool');
|
||||
|
||||
INSERT INTO `vn`.`itemType`(`id`, `code`, `name`, `categoryFk`, `warehouseFk`, `life`,`workerFk`, `isPackaging`, `temperatureFk`)
|
||||
VALUES
|
||||
(1, 'CRI', 'Crisantemo', 2, 1, 31, 35, 0, 'cool'),
|
||||
(2, 'ITG', 'Anthurium', 1, 1, 31, 35, 0, 'cool'),
|
||||
(3, 'WPN', 'Paniculata', 2, 1, 31, 35, 0, 'cool'),
|
||||
(4, 'PRT', 'Delivery ports', 3, 1, NULL, 35, 1, 'warm'),
|
||||
(5, 'CON', 'Container', 3, 1, NULL, 35, 1, 'warm'),
|
||||
(6, 'ALS', 'Alstroemeria', 1, 1, 31, 16, 0, 'warm');
|
||||
|
||||
INSERT INTO `vn`.`ink`(`id`, `name`, `picture`, `showOrder`, `hex`)
|
||||
VALUES
|
||||
|
@ -809,25 +821,25 @@ INSERT INTO `vn`.`itemFamily`(`code`, `description`)
|
|||
('VT', 'Sales');
|
||||
|
||||
INSERT INTO `vn`.`item`(`id`, `typeFk`, `size`, `inkFk`, `stems`, `originFk`, `description`, `producerFk`, `intrastatFk`, `expenceFk`,
|
||||
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`)
|
||||
`comment`, `relevancy`, `image`, `subName`, `minPrice`, `stars`, `family`, `isFloramondo`, `genericFk`, `itemPackingTypeFk`, `hasMinPrice`, `packingShelve`)
|
||||
VALUES
|
||||
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0),
|
||||
(2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0),
|
||||
(3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0),
|
||||
(4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0),
|
||||
(5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0),
|
||||
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0),
|
||||
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0),
|
||||
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0),
|
||||
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0),
|
||||
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0),
|
||||
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0),
|
||||
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0),
|
||||
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1),
|
||||
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0),
|
||||
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0),
|
||||
(16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0),
|
||||
(71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0);
|
||||
(1, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '1', NULL, 0, 1, 'VT', 0, NULL, 'V', 0, 15),
|
||||
(2, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '2', NULL, 0, 2, 'VT', 0, NULL, 'H', 0, 10),
|
||||
(3, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '3', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, 5),
|
||||
(4, 1, 60, 'YEL', 1, 1, 'Increases block', 1, 05080000, 4751000000, NULL, 0, '4', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(5, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '5', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(6, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '6', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(7, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '7', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(8, 2, 70, 'YEL', 1, 1, NULL, 1, 06021010, 2000000000, NULL, 0, '8', NULL, 0, 5, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(9, 2, 70, 'BLU', 1, 2, NULL, 1, 06021010, 2000000000, NULL, 0, '9', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL),
|
||||
(10, 1, 60, 'YEL', 1, 3, NULL, 1, 05080000, 4751000000, NULL, 0, '10', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(11, 1, 60, 'YEL', 1, 1, NULL, 1, 05080000, 4751000000, NULL, 0, '11', NULL, 0, 4, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(12, 3, 30, 'RED', 1, 2, NULL, 2, 06021010, 4751000000, NULL, 0, '12', NULL, 0, 3, 'VT', 0, NULL, NULL, 0, NULL),
|
||||
(13, 5, 30, 'RED', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '13', NULL, 1, 2, 'VT', 1, NULL, NULL, 1, NULL),
|
||||
(14, 5, 90, 'BLU', 1, 2, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 4, 'VT', 1, NULL, NULL, 0, NULL),
|
||||
(15, 4, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL),
|
||||
(16, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'EMB', 0, NULL, NULL, 0, NULL),
|
||||
(71, 6, NULL, NULL, NULL, 1, NULL, NULL, 06021010, 4751000000, NULL, 0, '', NULL, 0, 0, 'VT', 0, NULL, NULL, 0, NULL);
|
||||
|
||||
-- Update the taxClass after insert of the items
|
||||
UPDATE `vn`.`itemTaxCountry` SET `taxClassFk` = 2
|
||||
|
@ -854,18 +866,35 @@ INSERT INTO `vn`.`packaging`(`id`, `volume`, `width`, `height`, `depth`, `isPack
|
|||
('cc', 1640038.00, 56.00, 220.00, 128.00, 1, CURDATE(), 15, 90.00),
|
||||
('pallet 100', 2745600.00, 100.00, 220.00, 120.00, 1, CURDATE(), 16, 0.00);
|
||||
|
||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`, `externalId`, `packagingFk`)
|
||||
INSERT INTO `vn`.`expeditionStateType`(`id`, `description`, `code`)
|
||||
VALUES
|
||||
(1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 15, 1, 1, 18, 'UR9000006041', 94),
|
||||
(2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 16, 2, 1, 18, 'UR9000006041', 94),
|
||||
(3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 3, 1, 18, 'UR9000006041', 94),
|
||||
(4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 4, 1, 18, 'UR9000006041', 94),
|
||||
(5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94),
|
||||
(6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL, 1, 1, 18, NULL, 94),
|
||||
(7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94),
|
||||
(8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94),
|
||||
(9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94),
|
||||
(10, 7, 7, 71, NOW(), NULL, 1, 1, 18, NULL, 94);
|
||||
(1, 'En reparto', 'ON DELIVERY'),
|
||||
(2, 'Entregada', 'DELIVERED'),
|
||||
(3, 'Perdida', 'LOST');
|
||||
|
||||
|
||||
INSERT INTO `vn`.`expedition`(`id`, `agencyModeFk`, `ticketFk`, `isBox`, `created`, `itemFk`, `counter`, `checked`, `workerFk`, `externalId`, `packagingFk`, `stateTypeFk`)
|
||||
VALUES
|
||||
(1, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 15, 1, 1, 18, 'UR9000006041', 94, 1),
|
||||
(2, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), 16, 2, 1, 18, 'UR9000006041', 94, 1),
|
||||
(3, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 3, 1, 18, 'UR9000006041', 94, 2),
|
||||
(4, 1, 1, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 4, 1, 18, 'UR9000006041', 94, 2),
|
||||
(5, 1, 2, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 3),
|
||||
(6, 7, 3, 71, DATE_ADD(CURDATE(), INTERVAL -2 MONTH), NULL, 1, 1, 18, NULL, 94, 3),
|
||||
(7, 2, 4, 71, DATE_ADD(CURDATE(), INTERVAL -3 MONTH), NULL, 1, 1, 18, NULL, 94, NULL),
|
||||
(8, 3, 5, 71, DATE_ADD(CURDATE(), INTERVAL -4 MONTH), NULL, 1, 1, 18, NULL, 94, 1),
|
||||
(9, 3, 6, 71, DATE_ADD(CURDATE(), INTERVAL -1 MONTH), NULL, 1, 1, 18, NULL, 94, 2),
|
||||
(10, 7, 7, 71, NOW(), NULL, 1, 1, 18, NULL, 94, 3);
|
||||
|
||||
|
||||
INSERT INTO `vn`.`expeditionState`(`id`, `created`, `expeditionFk`, `typeFk`, `userFk`)
|
||||
VALUES
|
||||
(1, CURDATE(), 1, 1, 1),
|
||||
(2, CURDATE(), 2, 1, 1),
|
||||
(3, CURDATE(), 3, 1, 1),
|
||||
(4, CURDATE(), 3, 2, 1106),
|
||||
(5, CURDATE(), 5, 1, 1106),
|
||||
(6, CURDATE(), 5, 3, 1106);
|
||||
|
||||
INSERT INTO `vn`.`ticketPackaging`(`id`, `ticketFk`, `packagingFk`, `quantity`, `created`, `pvp`)
|
||||
VALUES
|
||||
|
@ -1296,11 +1325,11 @@ INSERT INTO `vn`.`supplierAddress`(`id`, `supplierFk`, `nickname`, `street`, `pr
|
|||
(5, 442, 'GCR building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222'),
|
||||
(6, 442, 'The Gotham Tonight building', 'Bristol district', 1, '46000', 'Gotham', '111111111', '222222222');
|
||||
|
||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`)
|
||||
INSERT INTO `vn`.`supplier`(`id`, `name`, `nickname`,`account`,`countryFk`,`nif`, `commission`, `created`, `isActive`, `street`, `city`, `provinceFk`, `postCode`, `payMethodFk`, `payDemFk`, `payDay`, `taxTypeSageFk`, `withholdingSageFk`, `transactionTypeSageFk`, `workerFk`, `supplierActivityFk`, `isPayMethodChecked`, `healthRegister`)
|
||||
VALUES
|
||||
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1),
|
||||
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1),
|
||||
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'flowerPlants', 1);
|
||||
(1, 'Plants SL', 'Plants nick', 4100000001, 1, '06089160W', 0, CURDATE(), 1, 'supplier address 1', 'PONTEVEDRA', 1, 15214, 1, 1, 15, 4, 1, 1, 18, 'flowerPlants', 1, '400664487V'),
|
||||
(2, 'Farmer King', 'The farmer', 4000020002, 1, '87945234L', 0, CURDATE(), 1, 'supplier address 2', 'SILLA', 2, 43022, 1, 2, 10, 93, 2, 8, 18, 'animals', 1, '400664487V'),
|
||||
(442, 'Verdnatura Levante SL', 'Verdnatura', 5115000442, 1, '06815934E', 0, CURDATE(), 1, 'supplier address 3', 'SILLA', 1, 43022, 1, 2, 15, 6, 9, 3, 18, 'complements', 1, '400664487V');
|
||||
|
||||
INSERT INTO `vn`.`supplierContact`(`id`, `supplierFk`, `phone`, `mobile`, `email`, `observation`, `name`)
|
||||
VALUES
|
||||
|
@ -1604,51 +1633,59 @@ INSERT INTO `hedera`.`orderRowComponent`(`rowFk`, `componentFk`, `price`)
|
|||
|
||||
INSERT INTO `hedera`.`visit`(`id`, `firstAgentFk`)
|
||||
VALUES
|
||||
(1, NULL),
|
||||
(2, NULL),
|
||||
(3, NULL),
|
||||
(4, NULL),
|
||||
(5, NULL),
|
||||
(6, NULL),
|
||||
(7, NULL),
|
||||
(8, NULL),
|
||||
(9, NULL);
|
||||
(1, NULL),
|
||||
(2, NULL),
|
||||
(3, NULL),
|
||||
(4, NULL),
|
||||
(5, NULL),
|
||||
(6, NULL),
|
||||
(7, NULL),
|
||||
(8, NULL),
|
||||
(9, NULL),
|
||||
(10, NULL),
|
||||
(11, NULL);
|
||||
|
||||
INSERT INTO `hedera`.`visitAgent`(`id`, `visitFk`)
|
||||
VALUES
|
||||
(1, 1),
|
||||
(2, 2),
|
||||
(3, 3),
|
||||
(4, 4),
|
||||
(5, 5),
|
||||
(6, 6),
|
||||
(7, 7),
|
||||
(8, 8),
|
||||
(9, 9);
|
||||
(1, 1),
|
||||
(2, 2),
|
||||
(3, 3),
|
||||
(4, 4),
|
||||
(5, 5),
|
||||
(6, 6),
|
||||
(7, 7),
|
||||
(8, 8),
|
||||
(9, 9),
|
||||
(10, 10),
|
||||
(11, 11);
|
||||
|
||||
INSERT INTO `hedera`.`visitAccess`(`id`, `agentFk`, `stamp`)
|
||||
VALUES
|
||||
(1, 1, CURDATE()),
|
||||
(2, 2, CURDATE()),
|
||||
(3, 3, CURDATE()),
|
||||
(4, 4, CURDATE()),
|
||||
(5, 5, CURDATE()),
|
||||
(6, 6, CURDATE()),
|
||||
(7, 7, CURDATE()),
|
||||
(8, 8, CURDATE()),
|
||||
(9, 9, CURDATE());
|
||||
(1, 1, CURDATE()),
|
||||
(2, 2, CURDATE()),
|
||||
(3, 3, CURDATE()),
|
||||
(4, 4, CURDATE()),
|
||||
(5, 5, CURDATE()),
|
||||
(6, 6, CURDATE()),
|
||||
(7, 7, CURDATE()),
|
||||
(8, 8, CURDATE()),
|
||||
(9, 9, CURDATE()),
|
||||
(10, 10, CURDATE()),
|
||||
(11, 11, CURDATE());
|
||||
|
||||
INSERT INTO `hedera`.`visitUser`(`id`, `accessFk`, `userFk`, `stamp`)
|
||||
VALUES
|
||||
(1, 1, 1101, CURDATE()),
|
||||
(2, 2, 1101, CURDATE()),
|
||||
(3, 3, 1101, CURDATE()),
|
||||
(4, 4, 1102, CURDATE()),
|
||||
(5, 5, 1102, CURDATE()),
|
||||
(6, 6, 1102, CURDATE()),
|
||||
(7, 7, 1103, CURDATE()),
|
||||
(8, 8, 1103, CURDATE()),
|
||||
(9, 9, 1103, CURDATE());
|
||||
(1, 1, 1101, CURDATE()),
|
||||
(2, 2, 1101, CURDATE()),
|
||||
(3, 3, 1101, CURDATE()),
|
||||
(4, 4, 1102, CURDATE()),
|
||||
(5, 5, 1102, CURDATE()),
|
||||
(6, 6, 1102, CURDATE()),
|
||||
(7, 7, 1103, CURDATE()),
|
||||
(8, 8, 1103, CURDATE()),
|
||||
(9, 9, 1103, CURDATE()),
|
||||
(10, 10, 1102, DATE_SUB(CURDATE(), INTERVAL 1 DAY)),
|
||||
(11, 11, 1103, DATE_SUB(CURDATE(), INTERVAL 1 DAY));
|
||||
|
||||
INSERT INTO `hedera`.`userSession`(`created`, `lastUpdate`, `ssid`, `data`, `userVisitFk`)
|
||||
VALUES
|
||||
|
@ -2273,11 +2310,6 @@ INSERT INTO `vn`.`workerTimeControlParams` (`id`, `dayBreak`, `weekBreak`, `week
|
|||
(1, 43200, 129600, 734400, 43200, 50400, 259200, 1296000, 36000);
|
||||
|
||||
INSERT IGNORE INTO `vn`.`greugeConfig` (`id`, `freightPickUpPrice`) VALUES ('1', '11');
|
||||
|
||||
INSERT INTO `vn`.`temperature`(`code`, `name`, `description`)
|
||||
VALUES
|
||||
('warm', 'Warm', 'Warm'),
|
||||
('cool', 'Cool', 'Cool');
|
||||
|
||||
INSERT INTO `vn`.`thermograph`(`id`, `model`)
|
||||
VALUES
|
||||
|
@ -2527,3 +2559,21 @@ INSERT INTO `vn`.`supplierAgencyTerm` (`agencyFk`, `supplierFk`, `minimumPackage
|
|||
(3, 2, 0, 15.00, 0.00, NULL, 0, 0.00, 0),
|
||||
(4, 2, 0, 20.00, 0.00, NULL, 0, 0.00, 0),
|
||||
(5, 442, 0, 0.00, 3.05, NULL, 0, 0.00, 0);
|
||||
|
||||
INSERT INTO `vn`.`mobileAppVersionControl` (`appName`, `version`, `isVersionCritical`)
|
||||
VALUES
|
||||
('delivery', '9.2', 0),
|
||||
('warehouse', '8.1', 0);
|
||||
|
||||
INSERT INTO `vn`.`machine` (`plate`, `maker`, `model`, `warehouseFk`, `departmentFk`, `type`, `use`, `productionYear`, `workerFk`, `companyFk`)
|
||||
VALUES
|
||||
('RE-001', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442),
|
||||
('RE-002', 'STILL', 'LTX-20', 60, 23, 'ELECTRIC TOW', 'Drag cars', 2020, 103, 442);
|
||||
|
||||
INSERT INTO `vn`.`machineWorker` (`workerFk`, `machineFk`, `inTimed`, `outTimed`)
|
||||
VALUES
|
||||
(1106, 1, CURDATE(), CURDATE()),
|
||||
(1106, 1, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY)),
|
||||
(1106, 2, CURDATE(), NULL),
|
||||
(1106, 2, DATE_ADD(CURDATE(), INTERVAL + 1 DAY), DATE_ADD(CURDATE(), INTERVAL +1 DAY));
|
||||
|
||||
|
|
|
@ -37460,6 +37460,31 @@ SET character_set_client = utf8;
|
|||
) ENGINE=MyISAM */;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Temporary table structure for view `printer`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `printer`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `printer` (
|
||||
`id` tinyint(3) unsigned NOT NULL,
|
||||
`name` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`path` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`modelFk` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`macWifi` varchar(20) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`ipAddress` varchar(15) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`reference` varchar(50) COLLATE utf8mb3_unicode_ci DEFAULT NULL,
|
||||
`isLabeler` tinyint(1) DEFAULT 0 COMMENT 'Indica si es impresora de etiquetas',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `printer_UN` (`reference`),
|
||||
UNIQUE KEY `printer_UN1` (`macWifi`),
|
||||
UNIQUE KEY `printer_UN2` (`name`),
|
||||
KEY `printer_FK` (`modelFk`),
|
||||
CONSTRAINT `printer_FK` FOREIGN KEY (`modelFk`) REFERENCES `printerModel` (`code`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_unicode_ci;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `printingQueueCheck`
|
||||
--
|
||||
|
|
|
@ -60,7 +60,6 @@ IGNORETABLES=(
|
|||
--ignore-table=vn.plantpassportAuthority__
|
||||
--ignore-table=vn.preparationException
|
||||
--ignore-table=vn.priceFixed__
|
||||
--ignore-table=vn.printer
|
||||
--ignore-table=vn.printingQueue
|
||||
--ignore-table=vn.printServerQueue__
|
||||
--ignore-table=vn.promissoryNote
|
||||
|
|
|
@ -982,8 +982,8 @@ export default {
|
|||
save: 'vn-invoice-in-basic-data button[type=submit]'
|
||||
},
|
||||
invoiceInTax: {
|
||||
addTaxButton: 'vn-invoice-in-tax vn-icon-button[icon="add_circle"]',
|
||||
thirdExpence: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.expenseFk"]',
|
||||
addTaxButton: 'vn-invoice-in-tax vn-icon-button[vn-tooltip="Add tax"]',
|
||||
thirdExpense: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.expenseFk"]',
|
||||
thirdTaxableBase: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-input-number[ng-model="invoiceInTax.taxableBase"]',
|
||||
thirdTaxType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.taxTypeSageFk"]',
|
||||
thirdTransactionType: 'vn-invoice-in-tax vn-horizontal:nth-child(3) > vn-autocomplete[ng-model="invoiceInTax.transactionTypeSageFk"]',
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
require('@babel/register')({presets: ['@babel/env']});
|
||||
require('core-js/stable');
|
||||
require('regenerator-runtime/runtime');
|
||||
|
||||
const axios = require('axios');
|
||||
const Docker = require('../../db/docker.js');
|
||||
const e2eConfig = require('./config.js');
|
||||
const log = require('fancy-log');
|
||||
|
||||
process.on('warning', warning => {
|
||||
console.log(warning.name);
|
||||
console.log(warning.message);
|
||||
console.log(warning.stack);
|
||||
});
|
||||
|
||||
async function test() {
|
||||
if (process.argv[2] === 'show')
|
||||
process.env.E2E_SHOW = true;
|
||||
|
||||
const container = new Docker('salix-db');
|
||||
|
||||
await container.run();
|
||||
|
||||
const Jasmine = require('jasmine');
|
||||
const jasmine = new Jasmine();
|
||||
|
||||
const specFiles = [
|
||||
`./e2e/paths/01*/*[sS]pec.js`,
|
||||
`./e2e/paths/02*/*[sS]pec.js`,
|
||||
`./e2e/paths/03*/*[sS]pec.js`,
|
||||
`./e2e/paths/04*/*[sS]pec.js`,
|
||||
`./e2e/paths/05*/*[sS]pec.js`,
|
||||
`./e2e/paths/06*/*[sS]pec.js`,
|
||||
`./e2e/paths/07*/*[sS]pec.js`,
|
||||
`./e2e/paths/08*/*[sS]pec.js`,
|
||||
`./e2e/paths/09*/*[sS]pec.js`,
|
||||
`./e2e/paths/10*/*[sS]pec.js`,
|
||||
`./e2e/paths/11*/*[sS]pec.js`,
|
||||
`./e2e/paths/12*/*[sS]pec.js`,
|
||||
`./e2e/paths/13*/*[sS]pec.js`,
|
||||
`./e2e/paths/**/*[sS]pec.js`
|
||||
];
|
||||
|
||||
jasmine.loadConfig({
|
||||
spec_dir: '.',
|
||||
spec_files: specFiles,
|
||||
helpers: [],
|
||||
random: false,
|
||||
});
|
||||
|
||||
await backendStatus();
|
||||
|
||||
jasmine.jasmine.DEFAULT_TIMEOUT_INTERVAL = 30000;
|
||||
await jasmine.execute();
|
||||
}
|
||||
|
||||
async function backendStatus() {
|
||||
log('Awaiting backend connection...');
|
||||
|
||||
const milliseconds = 1000;
|
||||
const maxAttempts = 10;
|
||||
|
||||
return new Promise(resolve => {
|
||||
let timer;
|
||||
let attempts = 1;
|
||||
timer = setInterval(async() => {
|
||||
try {
|
||||
attempts++;
|
||||
const url = `${e2eConfig.url}/api/Applications/status`;
|
||||
const {data} = await axios.get(url);
|
||||
|
||||
if (data == true) {
|
||||
clearInterval(timer);
|
||||
log('Backend connection stablished!');
|
||||
resolve(attempts);
|
||||
}
|
||||
} catch (error) {
|
||||
if (error && attempts >= maxAttempts) {
|
||||
log('Could not connect to backend');
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
}, milliseconds);
|
||||
});
|
||||
}
|
||||
|
||||
test();
|
|
@ -19,7 +19,7 @@ describe('InvoiceIn tax path', () => {
|
|||
|
||||
it('should add a new tax', async() => {
|
||||
await page.waitToClick(selectors.invoiceInTax.addTaxButton);
|
||||
await page.autocompleteSearch(selectors.invoiceInTax.thirdExpence, '6210000567');
|
||||
await page.autocompleteSearch(selectors.invoiceInTax.thirdExpense, '6210000567');
|
||||
await page.write(selectors.invoiceInTax.thirdTaxableBase, '100');
|
||||
await page.autocompleteSearch(selectors.invoiceInTax.thirdTaxType, '6');
|
||||
await page.autocompleteSearch(selectors.invoiceInTax.thirdTransactionType, 'Operaciones exentas');
|
||||
|
@ -37,9 +37,9 @@ describe('InvoiceIn tax path', () => {
|
|||
expect(result).toEqual('Taxable base €1,323.16');
|
||||
});
|
||||
|
||||
it('should navigate back to the tax section and check the reciently added line contains the expected expense', async() => {
|
||||
it('should navigate back to tax section, check the reciently added line contains the expected expense', async() => {
|
||||
await page.accessToSection('invoiceIn.card.tax');
|
||||
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpence, 'value');
|
||||
const result = await page.waitToGetProperty(selectors.invoiceInTax.thirdExpense, 'value');
|
||||
|
||||
expect(result).toEqual('6210000567: Alquiler VNH');
|
||||
});
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
</vn-check>
|
||||
<vn-icon-button
|
||||
class="vn-pl-none"
|
||||
ng-if="$ctrl.checked && $ctrl.checkDummyEnabled"
|
||||
ng-if="$ctrl.isCheckedDummy()"
|
||||
icon="expand_more"
|
||||
vn-popover="menu"
|
||||
ng-click="$ctrl.countRows()">
|
||||
</vn-icon-button>
|
||||
<vn-menu vn-id="menu">
|
||||
<vn-menu
|
||||
vn-id="menu"
|
||||
ng-if="$ctrl.isCheckedDummy()">
|
||||
<vn-list>
|
||||
<span translate>All</span>
|
||||
<span class="bold">
|
||||
|
|
|
@ -146,16 +146,17 @@ export default class MultiCheck extends FormInput {
|
|||
if (!this.model || !this.model.data) return;
|
||||
|
||||
const data = this.model.data;
|
||||
const modelParams = this.model.userParams;
|
||||
const params = {
|
||||
filter: {
|
||||
modelParams: modelParams,
|
||||
limit: null
|
||||
}
|
||||
};
|
||||
if (this.model.userFilter)
|
||||
Object.assign(params.filter, this.model.userFilter);
|
||||
if (this.model.userParams)
|
||||
Object.assign(params, this.model.userParams);
|
||||
|
||||
this.rows = data.length;
|
||||
|
||||
this.$http.get(this.model.url, {params})
|
||||
.then(res => {
|
||||
this.allRowsCount = res.data.length;
|
||||
|
@ -172,6 +173,10 @@ export default class MultiCheck extends FormInput {
|
|||
this.checkedDummyCount = this.allRowsCount;
|
||||
}
|
||||
|
||||
isCheckedDummy() {
|
||||
return this.checked && this.checkDummyEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggles checked property on
|
||||
* all instances
|
||||
|
|
|
@ -190,4 +190,30 @@ describe('Component vnMultiCheck', () => {
|
|||
expect(controller.checkedDummyCount).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isCheckedDummy()', () => {
|
||||
it(`should return true only if is checked and checked dummy is enabled`, () => {
|
||||
controller.checked = true;
|
||||
controller.checkDummyEnabled = true;
|
||||
const isCheckedDummy = controller.isCheckedDummy();
|
||||
|
||||
expect(isCheckedDummy).toEqual(true);
|
||||
});
|
||||
|
||||
it(`should return false if not checked`, () => {
|
||||
controller.checked = false;
|
||||
controller.checkDummyEnabled = true;
|
||||
const isCheckedDummy = controller.isCheckedDummy();
|
||||
|
||||
expect(isCheckedDummy).toEqual(false);
|
||||
});
|
||||
|
||||
it(`should return false if checked dummy is disabled`, () => {
|
||||
controller.checked = true;
|
||||
controller.checkDummyEnabled = false;
|
||||
const isCheckedDummy = controller.isCheckedDummy();
|
||||
|
||||
expect(isCheckedDummy).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,15 +3,8 @@ vn-multi-check {
|
|||
.vn-check {
|
||||
margin-bottom: 12px
|
||||
}
|
||||
|
||||
vn-list{
|
||||
padding: 50px;
|
||||
}
|
||||
vn-menu{
|
||||
padding: 50px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.bold{
|
||||
font-weight: bold;
|
||||
}
|
|
@ -46,11 +46,13 @@
|
|||
</div>
|
||||
</vn-horizontal>
|
||||
<div id="table"></div>
|
||||
<vn-pagination
|
||||
ng-if="$ctrl.model"
|
||||
model="$ctrl.model"
|
||||
class="vn-pt-md">
|
||||
</vn-pagination>
|
||||
<div ng-transclude="pagination">
|
||||
<vn-pagination
|
||||
ng-if="$ctrl.model"
|
||||
model="$ctrl.model"
|
||||
class="vn-pt-md">
|
||||
</vn-pagination>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<vn-confirm
|
||||
|
|
|
@ -497,7 +497,8 @@ ngModule.vnComponent('smartTable', {
|
|||
controller: SmartTable,
|
||||
transclude: {
|
||||
table: '?slotTable',
|
||||
actions: '?slotActions'
|
||||
actions: '?slotActions',
|
||||
pagination: '?slotPagination'
|
||||
},
|
||||
bindings: {
|
||||
model: '<?',
|
||||
|
|
189
gulpfile.js
189
gulpfile.js
|
@ -3,8 +3,6 @@ const gulp = require('gulp');
|
|||
const PluginError = require('plugin-error');
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
const log = require('fancy-log');
|
||||
const got = require('got');
|
||||
const e2eConfig = require('./e2e/helpers/config.js');
|
||||
const Docker = require('./db/docker.js');
|
||||
|
||||
// Configuration
|
||||
|
@ -67,187 +65,6 @@ back.description = `Starts backend and database service`;
|
|||
|
||||
const defaultTask = gulp.parallel(front, back);
|
||||
defaultTask.description = `Starts all application services`;
|
||||
|
||||
// Backend tests - Private method
|
||||
|
||||
async function launchBackTest(done) {
|
||||
let err;
|
||||
let dataSources = require('./loopback/server/datasources.json');
|
||||
|
||||
const container = new Docker();
|
||||
await container.run(argv.ci);
|
||||
|
||||
dataSources = JSON.parse(JSON.stringify(dataSources));
|
||||
|
||||
Object.assign(dataSources.vn, {
|
||||
host: container.dbConf.host,
|
||||
port: container.dbConf.port
|
||||
});
|
||||
|
||||
let bootOptions = {dataSources};
|
||||
|
||||
let app = require(`./loopback/server/server`);
|
||||
|
||||
try {
|
||||
app.boot(bootOptions);
|
||||
|
||||
await new Promise((resolve, reject) => {
|
||||
const jasmine = require('gulp-jasmine');
|
||||
|
||||
const options = {
|
||||
verbose: false,
|
||||
includeStackTrace: false,
|
||||
errorOnFail: false,
|
||||
timeout: 5000,
|
||||
config: {}
|
||||
};
|
||||
|
||||
if (argv.ci) {
|
||||
const reporters = require('jasmine-reporters');
|
||||
options.reporter = new reporters.JUnitXmlReporter();
|
||||
}
|
||||
|
||||
let backSpecFiles = [
|
||||
'back/**/*.spec.js',
|
||||
'loopback/**/*.spec.js',
|
||||
'modules/*/back/**/*.spec.js'
|
||||
];
|
||||
|
||||
gulp.src(backSpecFiles)
|
||||
.pipe(jasmine(options))
|
||||
.on('end', resolve)
|
||||
.on('error', reject)
|
||||
.resume();
|
||||
});
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
await app.disconnect();
|
||||
await container.rm();
|
||||
done();
|
||||
if (err)
|
||||
throw err;
|
||||
}
|
||||
launchBackTest.description = `
|
||||
Runs the backend tests once using a random container, can receive --ci arg to save reports on a xml file`;
|
||||
|
||||
// Backend tests
|
||||
|
||||
function backTest(done) {
|
||||
const nodemon = require('gulp-nodemon');
|
||||
|
||||
nodemon({
|
||||
exec: ['node --tls-min-v1.0 ./node_modules/gulp/bin/gulp.js'],
|
||||
args: ['launchBackTest'],
|
||||
watch: backSources,
|
||||
done: done
|
||||
});
|
||||
}
|
||||
backTest.description = `Watches for changes in modules to execute backTest task`;
|
||||
|
||||
// End to end tests
|
||||
function e2eSingleRun() {
|
||||
require('@babel/register')({presets: ['@babel/env']});
|
||||
require('core-js/stable');
|
||||
require('regenerator-runtime/runtime');
|
||||
|
||||
const jasmine = require('gulp-jasmine');
|
||||
const SpecReporter = require('jasmine-spec-reporter').SpecReporter;
|
||||
|
||||
if (argv.show || argv.s)
|
||||
process.env.E2E_SHOW = true;
|
||||
|
||||
const specFiles = [
|
||||
`${__dirname}/e2e/paths/01*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/02*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/03*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/04*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/05*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/06*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/07*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/08*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/09*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/10*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/11*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/12*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/13*/*[sS]pec.js`,
|
||||
`${__dirname}/e2e/paths/**/*[sS]pec.js`
|
||||
];
|
||||
|
||||
return gulp.src(specFiles).pipe(jasmine({
|
||||
errorOnFail: false,
|
||||
timeout: 30000,
|
||||
config: {
|
||||
random: false,
|
||||
// TODO: Waiting for this option to be implemented
|
||||
// https://github.com/jasmine/jasmine/issues/1533
|
||||
stopSpecOnExpectationFailure: false
|
||||
},
|
||||
reporter: [
|
||||
new SpecReporter({
|
||||
spec: {
|
||||
displayStacktrace: 'none',
|
||||
displaySuccessful: true,
|
||||
displayFailedSpec: true,
|
||||
displaySpecDuration: true,
|
||||
},
|
||||
summary: {
|
||||
displayStacktrace: 'raw',
|
||||
displayPending: false
|
||||
},
|
||||
colors: {
|
||||
enabled: true,
|
||||
successful: 'brightGreen',
|
||||
failed: 'brightRed'
|
||||
},
|
||||
// stacktrace: {
|
||||
// filter: stacktrace => {
|
||||
// const lines = stacktrace.split('\n');
|
||||
// const filtered = [];
|
||||
// for (let i = 1; i < lines.length; i++) {
|
||||
// if (/e2e\/paths/.test(lines[i]))
|
||||
// filtered.push(lines[i]);
|
||||
// }
|
||||
// return filtered.join('\n');
|
||||
// }
|
||||
// }
|
||||
})
|
||||
]
|
||||
}));
|
||||
}
|
||||
|
||||
e2e = gulp.series(docker, async function isBackendReady() {
|
||||
const attempts = await backendStatus();
|
||||
log(`Backend ready after ${attempts} attempt(s)`);
|
||||
|
||||
return attempts;
|
||||
}, e2eSingleRun);
|
||||
e2e.description = `Restarts database and runs the e2e tests`;
|
||||
|
||||
async function backendStatus() {
|
||||
const milliseconds = 250;
|
||||
return new Promise(resolve => {
|
||||
let timer;
|
||||
let attempts = 1;
|
||||
timer = setInterval(async() => {
|
||||
try {
|
||||
const url = `${e2eConfig.url}/api/Applications/status`;
|
||||
const {body} = await got.get(url);
|
||||
|
||||
if (body == 'true') {
|
||||
clearInterval(timer);
|
||||
resolve(attempts);
|
||||
} else
|
||||
attempts++;
|
||||
} catch (error) {
|
||||
if (error || attempts > 100) // 250ms * 100 => 25s timeout
|
||||
throw new Error('Could not connect to backend');
|
||||
}
|
||||
}, milliseconds);
|
||||
});
|
||||
}
|
||||
backendStatus.description = `Performs a simple requests to check the backend status`;
|
||||
|
||||
function install() {
|
||||
const install = require('gulp-install');
|
||||
const print = require('gulp-print');
|
||||
|
@ -431,9 +248,6 @@ module.exports = {
|
|||
back,
|
||||
backOnly,
|
||||
backWatch,
|
||||
backTest,
|
||||
launchBackTest,
|
||||
e2e,
|
||||
i,
|
||||
install,
|
||||
build,
|
||||
|
@ -444,6 +258,5 @@ module.exports = {
|
|||
locales,
|
||||
localesRoutes,
|
||||
watch,
|
||||
docker,
|
||||
backendStatus,
|
||||
docker
|
||||
};
|
||||
|
|
|
@ -47,5 +47,6 @@ module.exports = {
|
|||
'^.+\\.js?$': 'babel-jest',
|
||||
'^.+\\.html$': 'html-loader-jest'
|
||||
},
|
||||
reporters: ['default', 'jest-junit']
|
||||
};
|
||||
|
||||
|
|
|
@ -9,19 +9,19 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"model": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"property":{
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"actionType":{
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"role":{
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"verifyCert": {
|
||||
"type": "Boolean"
|
||||
"type": "boolean"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"userFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "The user id",
|
||||
"mysql": {
|
||||
|
@ -16,7 +16,7 @@
|
|||
}
|
||||
},
|
||||
"extension": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -6,7 +6,6 @@ class Controller extends Component {
|
|||
this._role = value;
|
||||
this.$.summary = null;
|
||||
if (!value) return;
|
||||
|
||||
this.$http.get(`Roles/${value.id}`)
|
||||
.then(res => this.$.summary = res.data);
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"quantity": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"description": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
],
|
||||
"properties": {
|
||||
"dmsFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"required": true
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
}
|
||||
|
|
|
@ -9,40 +9,40 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"forceId": false
|
||||
},
|
||||
"originFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"userFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"action": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"changedModel": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"oldInstance": {
|
||||
"type": "Object"
|
||||
"type": "object"
|
||||
},
|
||||
"newInstance": {
|
||||
"type": "Object"
|
||||
"type": "object"
|
||||
},
|
||||
"creationDate": {
|
||||
"type": "Date"
|
||||
"type": "date"
|
||||
},
|
||||
"changedModelId": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"changedModelValue": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -9,23 +9,23 @@
|
|||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"clientFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"yearSale": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"claimAmount": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"claimingRate": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"priceIncreasing": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"packingRate": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"description": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"description": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -8,16 +8,16 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"description": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"responsability": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"description": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
|
|
|
@ -39,7 +39,7 @@ module.exports = Self => {
|
|||
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
|
||||
const sms = await models.Sms.send(ctx, id, destination, message);
|
||||
const sms = await models.Sms.send(ctx, destination, message);
|
||||
const logRecord = {
|
||||
originFk: id,
|
||||
userFk: userId,
|
||||
|
|
|
@ -12,11 +12,13 @@ describe('Client updatePortfolio', () => {
|
|||
|
||||
const expectedResult = 841.63;
|
||||
|
||||
await models.Client.rawSql(`UPDATE vn.client SET salesPersonFk = ${salesPersonId} WHERE id = ${clientId}; `);
|
||||
const clientQuery = `UPDATE vn.client SET salesPersonFk = ${salesPersonId} WHERE id = ${clientId}; `;
|
||||
await models.Client.rawSql(clientQuery);
|
||||
|
||||
await models.Client.updatePortfolio();
|
||||
|
||||
let [salesPerson] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `, null, options);
|
||||
const portfolioQuery = `SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `;
|
||||
const [salesPerson] = await models.Client.rawSql(portfolioQuery, null, options);
|
||||
|
||||
expect(salesPerson.portfolioWeight).toEqual(expectedResult);
|
||||
|
||||
|
@ -26,8 +28,9 @@ describe('Client updatePortfolio', () => {
|
|||
throw e;
|
||||
}
|
||||
});
|
||||
// task 3817
|
||||
xit('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => {
|
||||
|
||||
it('should keep the same portfolioWeight when a salesperson is unassigned of a client', async() => {
|
||||
pending('task 3817');
|
||||
const salesPersonId = 19;
|
||||
const tx = await models.Client.beginTransaction({});
|
||||
|
||||
|
@ -40,7 +43,8 @@ describe('Client updatePortfolio', () => {
|
|||
|
||||
await models.Client.updatePortfolio();
|
||||
|
||||
let [salesPerson] = await models.Client.rawSql(`SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `, null, options);
|
||||
const portfolioQuery = `SELECT portfolioWeight FROM bs.salesPerson WHERE workerFk = ${salesPersonId}; `;
|
||||
const [salesPerson] = await models.Client.rawSql(portfolioQuery, null, options);
|
||||
|
||||
expect(salesPerson.portfolioWeight).toEqual(expectedResult);
|
||||
|
||||
|
|
|
@ -6,10 +6,6 @@ module.exports = Self => {
|
|||
description: 'Sends SMS to a destination phone',
|
||||
accessType: 'WRITE',
|
||||
accepts: [
|
||||
{
|
||||
arg: 'destinationFk',
|
||||
type: 'integer'
|
||||
},
|
||||
{
|
||||
arg: 'destination',
|
||||
type: 'string',
|
||||
|
@ -31,7 +27,7 @@ module.exports = Self => {
|
|||
}
|
||||
});
|
||||
|
||||
Self.send = async(ctx, destinationFk, destination, message) => {
|
||||
Self.send = async(ctx, destination, message) => {
|
||||
const userId = ctx.req.accessToken.userId;
|
||||
const smsConfig = await Self.app.models.SmsConfig.findOne();
|
||||
|
||||
|
@ -68,7 +64,6 @@ module.exports = Self => {
|
|||
|
||||
const newSms = {
|
||||
senderFk: userId,
|
||||
destinationFk: destinationFk || null,
|
||||
destination: destination,
|
||||
message: message,
|
||||
status: error
|
||||
|
|
|
@ -3,7 +3,7 @@ const app = require('vn-loopback/server/server');
|
|||
describe('sms send()', () => {
|
||||
it('should not return status error', async() => {
|
||||
const ctx = {req: {accessToken: {userId: 1}}};
|
||||
const result = await app.models.Sms.send(ctx, 1105, '123456789', 'My SMS Body');
|
||||
const result = await app.models.Sms.send(ctx, '123456789', 'My SMS Body');
|
||||
|
||||
expect(result.status).toBeUndefined();
|
||||
});
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
"Client": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ClientConfig": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
"ClientContact": {
|
||||
"dataSource": "vn"
|
||||
},
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
|
@ -43,10 +43,10 @@
|
|||
"type": "boolean"
|
||||
},
|
||||
"longitude": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"latitude": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"isEqualizated": {
|
||||
"type": "boolean"
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "ClientConfig",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientConfig"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"riskTolerance": {
|
||||
"type": "number"
|
||||
},
|
||||
"maxCreditRows": {
|
||||
"type": "number"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,34 +3,34 @@
|
|||
"description": "Client phone contacts",
|
||||
"base": "Loggable",
|
||||
"log": {
|
||||
"model": "ClientLog",
|
||||
"relation": "client",
|
||||
"showField": "name"
|
||||
"model": "ClientLog",
|
||||
"relation": "client",
|
||||
"showField": "name"
|
||||
},
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientContact"
|
||||
}
|
||||
"mysql": {
|
||||
"table": "clientContact"
|
||||
}
|
||||
},
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
}
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"name": {
|
||||
"type": "string"
|
||||
},
|
||||
"phone": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "clientFk"
|
||||
}
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "clientFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,26 +1,26 @@
|
|||
{
|
||||
"name": "ClientCreditLimit",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientCreditLimit"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
"name": "ClientCreditLimit",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientCreditLimit"
|
||||
}
|
||||
},
|
||||
"maxAmount": {
|
||||
"type": "Number"
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"maxAmount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"role": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"foreignKey": "roleFk"
|
||||
}
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"role": {
|
||||
"type": "belongsTo",
|
||||
"model": "Role",
|
||||
"foreignKey": "roleFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
module.exports = Self => {
|
||||
Self.observe('after save', async ctx => {
|
||||
const instance = ctx.instance;
|
||||
const models = Self.app.models;
|
||||
|
||||
const clientConfig = await models.ClientConfig.findOne();
|
||||
const maxCreditRows = clientConfig.maxCreditRows;
|
||||
|
||||
const clientCredit = await models.ClientCredit.find({
|
||||
where: {clientFk: instance.clientFk},
|
||||
order: 'created DESC',
|
||||
limit: maxCreditRows
|
||||
}, ctx.options);
|
||||
|
||||
const lastCredit = clientCredit[maxCreditRows - 1];
|
||||
if (lastCredit) {
|
||||
await models.ClientCredit.destroyAll({
|
||||
clientFk: instance.clientFk,
|
||||
created: {lt: lastCredit.created}
|
||||
}, ctx.options);
|
||||
}
|
||||
});
|
||||
};
|
|
@ -1,36 +1,36 @@
|
|||
{
|
||||
"name": "ClientCredit",
|
||||
"description": "Log of credit changes",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientCredit"
|
||||
}
|
||||
},
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
"name": "ClientCredit",
|
||||
"description": "Log of credit changes",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientCredit"
|
||||
}
|
||||
},
|
||||
"amount": {
|
||||
"type": "Number"
|
||||
"validateUpsert": true,
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"amount": {
|
||||
"type": "number"
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
}
|
||||
},
|
||||
"created": {
|
||||
"type": "date"
|
||||
"relations": {
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "clientFk"
|
||||
},
|
||||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"client": {
|
||||
"type": "belongsTo",
|
||||
"model": "Client",
|
||||
"foreignKey": "clientFk"
|
||||
},
|
||||
"worker": {
|
||||
"type": "belongsTo",
|
||||
"model": "Worker",
|
||||
"foreignKey": "workerFk"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,12 +13,12 @@
|
|||
},
|
||||
"properties": {
|
||||
"dmsFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"required": true
|
||||
},
|
||||
"clientFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
}
|
||||
},
|
||||
|
|
|
@ -9,40 +9,40 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"forceId": false
|
||||
},
|
||||
"originFk": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"userFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"action": {
|
||||
"type": "String",
|
||||
"type": "string",
|
||||
"required": true
|
||||
},
|
||||
"changedModel": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"oldInstance": {
|
||||
"type": "Object"
|
||||
"type": "object"
|
||||
},
|
||||
"newInstance": {
|
||||
"type": "Object"
|
||||
"type": "object"
|
||||
},
|
||||
"creationDate": {
|
||||
"type": "Date"
|
||||
"type": "date"
|
||||
},
|
||||
"changedModelId": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"changedModelValue": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
},
|
||||
"description": {
|
||||
"type": "String"
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
},
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"id": true,
|
||||
"description": "Identifier"
|
||||
},
|
||||
"clientFk": {
|
||||
"type": "Number"
|
||||
"type": "number"
|
||||
},
|
||||
"text": {
|
||||
"type": "string",
|
||||
|
|
|
@ -2,22 +2,22 @@
|
|||
"name": "ClientRisk",
|
||||
"base": "VnModel",
|
||||
"options": {
|
||||
"mysql": {
|
||||
"table": "clientRisk"
|
||||
}
|
||||
"mysql": {
|
||||
"table": "clientRisk"
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"clientFk": {
|
||||
"type": "Number",
|
||||
"id": true
|
||||
},
|
||||
"companyFk": {
|
||||
"type": "Number",
|
||||
"id": true
|
||||
},
|
||||
"amount": {
|
||||
"type": "Number"
|
||||
}
|
||||
"clientFk": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"companyFk": {
|
||||
"type": "number",
|
||||
"id": true
|
||||
},
|
||||
"amount": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"relations": {
|
||||
"client": {
|
||||
|
@ -31,4 +31,4 @@
|
|||
"foreignKey": "companyFk"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@
|
|||
"properties": {
|
||||
"id": {
|
||||
"id": true,
|
||||
"type": "Number",
|
||||
"type": "number",
|
||||
"description": "Identifier"
|
||||
},
|
||||
"created": {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue