feat(worker_new): create client with default business type
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
ebee9144b4
commit
594b4c36d1
|
@ -0,0 +1,5 @@
|
||||||
|
ALTER TABLE `vn`.`workerConfig` ADD businessTypeFk varchar(100) NULL COMMENT 'Tipo de negocio por defecto al dar de alta un trabajador nuevo';
|
||||||
|
|
||||||
|
UPDATE `vn`.`workerConfig`
|
||||||
|
SET businessTypeFk = 'individual'
|
||||||
|
WHERE id = 1;
|
|
@ -2781,10 +2781,6 @@ INSERT INTO `vn`.`profileType` (`id`, `name`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 'working');
|
(1, 'working');
|
||||||
|
|
||||||
INSERT INTO `vn`.`newWorkerConfig` (`id`, `street`, `provinceFk`, `companyFk`, `profileTypeFk`, `roleFk`)
|
|
||||||
VALUES
|
|
||||||
(1, 'S/ ', 1, 442, 1, 1);
|
|
||||||
|
|
||||||
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
INSERT INTO `salix`.`url` (`appName`, `environment`, `url`)
|
||||||
VALUES
|
VALUES
|
||||||
('lilium', 'dev', 'http://localhost:8080/#/'),
|
('lilium', 'dev', 'http://localhost:8080/#/'),
|
||||||
|
@ -2794,7 +2790,7 @@ INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, 1);
|
(1, 1);
|
||||||
|
|
||||||
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`)
|
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `businessTypeFk`)
|
||||||
VALUES
|
VALUES
|
||||||
(1, NULL, 1);
|
(1, NULL, 1, 'individual');
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* eslint max-len: ["error", { "code": 130 }]*/
|
/* eslint max-len: ["error", { "code": 150 }]*/
|
||||||
const UserError = require('vn-loopback/util/user-error');
|
const UserError = require('vn-loopback/util/user-error');
|
||||||
|
|
||||||
module.exports = Self => {
|
module.exports = Self => {
|
||||||
|
@ -139,7 +139,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
if (!client) {
|
if (!client) {
|
||||||
const nickname = args.firstName.concat(' ', args.lastNames);
|
const nickname = args.firstName.concat(' ', args.lastNames);
|
||||||
const workerConfig = await models.WorkerConfig.findOne({fields: ['roleFk']});
|
const workerConfig = await models.WorkerConfig.findOne({fields: ['roleFk', 'businessTypeFk']});
|
||||||
const [randomPassword] = await models.Worker.rawSql(
|
const [randomPassword] = await models.Worker.rawSql(
|
||||||
'SELECT account.passwordGenerate() as password;'
|
'SELECT account.passwordGenerate() as password;'
|
||||||
);
|
);
|
||||||
|
@ -196,7 +196,7 @@ module.exports = Self => {
|
||||||
|
|
||||||
client = await models.Client.findById(
|
client = await models.Client.findById(
|
||||||
user.id,
|
user.id,
|
||||||
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']},
|
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk', 'businessTypeFk']},
|
||||||
myOptions
|
myOptions
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -205,6 +205,7 @@ module.exports = Self => {
|
||||||
iban: args.iban,
|
iban: args.iban,
|
||||||
bankEntityFk: args.bankEntityFk,
|
bankEntityFk: args.bankEntityFk,
|
||||||
defaultAddressFk: address.id,
|
defaultAddressFk: address.id,
|
||||||
|
businessTypeFk: workerConfig.businessTypeFk
|
||||||
},
|
},
|
||||||
myOptions
|
myOptions
|
||||||
);
|
);
|
||||||
|
|
|
@ -14,6 +14,9 @@
|
||||||
},
|
},
|
||||||
"roleFk": {
|
"roleFk": {
|
||||||
"type": "number"
|
"type": "number"
|
||||||
|
},
|
||||||
|
"businessTypeFk": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acls": [
|
"acls": [
|
||||||
|
|
Loading…
Reference in New Issue