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
|
||||
(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`)
|
||||
VALUES
|
||||
('lilium', 'dev', 'http://localhost:8080/#/'),
|
||||
|
@ -2794,7 +2790,7 @@ INSERT INTO `vn`.`payDemDetail` (`id`, `detail`)
|
|||
VALUES
|
||||
(1, 1);
|
||||
|
||||
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`)
|
||||
INSERT INTO `vn`.`workerConfig` (`id`, `businessUpdated`, `roleFk`, `businessTypeFk`)
|
||||
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');
|
||||
|
||||
module.exports = Self => {
|
||||
|
@ -139,7 +139,7 @@ module.exports = Self => {
|
|||
|
||||
if (!client) {
|
||||
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(
|
||||
'SELECT account.passwordGenerate() as password;'
|
||||
);
|
||||
|
@ -196,7 +196,7 @@ module.exports = Self => {
|
|||
|
||||
client = await models.Client.findById(
|
||||
user.id,
|
||||
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk']},
|
||||
{fields: ['id', 'name', 'socialName', 'street', 'city', 'iban', 'bankEntityFk', 'defaultAddressFk', 'businessTypeFk']},
|
||||
myOptions
|
||||
);
|
||||
|
||||
|
@ -205,6 +205,7 @@ module.exports = Self => {
|
|||
iban: args.iban,
|
||||
bankEntityFk: args.bankEntityFk,
|
||||
defaultAddressFk: address.id,
|
||||
businessTypeFk: workerConfig.businessTypeFk
|
||||
},
|
||||
myOptions
|
||||
);
|
||||
|
|
|
@ -14,6 +14,9 @@
|
|||
},
|
||||
"roleFk": {
|
||||
"type": "number"
|
||||
},
|
||||
"businessTypeFk": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"acls": [
|
||||
|
|
Loading…
Reference in New Issue