diff --git a/db/changes/240401/00-revokeItem.sql b/db/changes/240401/00-revokeItem.sql index 2b75d67cf..5f6a30620 100644 --- a/db/changes/240401/00-revokeItem.sql +++ b/db/changes/240401/00-revokeItem.sql @@ -1,4 +1,4 @@ REVOKE UPDATE ON TABLE `vn`.`item` FROM `employee`; -GRANT UPDATE(id, equivalent, stems, minPrice, isToPrint, family, box, category, doPhoto, image, inkFk, intrastatFk, hasMinPrice, created, comment, typeFk, generic, producerFk, description, density, relevancy, expenseFk, isActive, subName, tag5, value5, tag6, value6, tag7, value7, tag8, value8, tag9, value9, tag10, value10, minimum, upToDown, supplyResponseFk, hasKgPrice, isFloramondo, isFragile, numberOfItemsPerCask, embalageCode, quality, stemMultiplier, itemPackingTypeFk, packingOut, genericFk, packingShelve, isLaid, lastUsed, weightByPiece, weightByPiece, editorFk, recycledPlastic, nonRecycledPlastic, minQuantity) ON TABLE vn.item TO employee; +GRANT UPDATE(id, equivalent, stems, minPrice, isToPrint, family, box, category, doPhoto, image, inkFk, intrastatFk, hasMinPrice, created, comment, typeFk, generic, producerFk, description, density, relevancy, expenseFk, isActive, subName, tag5, value5, tag6, value6, tag7, value7, tag8, value8, tag9, value9, tag10, value10, minimum, upToDown, supplyResponseFk, hasKgPrice, isFloramondo, isFragile, numberOfItemsPerCask, embalageCode, quality, stemMultiplier, itemPackingTypeFk, packingOut, genericFk, packingShelve, isLaid, lastUsed, weightByPiece, weightByPiece, editorFk, recycledPlastic, nonRecycledPlastic, minQuantity) ON TABLE `vn`.`item` TO `employee`; diff --git a/db/changes/240201/00-ticketSmsToClientSms.sql b/db/changes/240401/00-ticketSmsToClientSms.sql similarity index 100% rename from db/changes/240201/00-ticketSmsToClientSms.sql rename to db/changes/240401/00-ticketSmsToClientSms.sql diff --git a/db/changes/235001/00-updateACL_Role_VnRole.sql b/db/changes/240401/00-updateACL_Role_VnRole.sql similarity index 59% rename from db/changes/235001/00-updateACL_Role_VnRole.sql rename to db/changes/240401/00-updateACL_Role_VnRole.sql index b08a44138..5d108ac44 100644 --- a/db/changes/235001/00-updateACL_Role_VnRole.sql +++ b/db/changes/240401/00-updateACL_Role_VnRole.sql @@ -1,4 +1,4 @@ -INSERT INTO salix.ACL (model,property,accessType,permission,principalType,principalId) VALUES +INSERT INTO `salix`.`ACL` (model,property,accessType,permission,principalType,principalId) VALUES ('VnRole','*','READ','ALLOW','ROLE','employee'), ('VnRole','*','WRITE','ALLOW','ROLE','it'); diff --git a/db/changes/240401/01-saleGroupDetailDefaultSize.sql b/db/changes/240401/01-saleGroupDetailDefaultSize.sql index 12f17c5e7..34529ba78 100644 --- a/db/changes/240401/01-saleGroupDetailDefaultSize.sql +++ b/db/changes/240401/01-saleGroupDetailDefaultSize.sql @@ -1,2 +1,2 @@ -ALTER TABLE vn.productionConfig ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa'; -UPDATE IGNORE vn.productionConfig SET itemPreviousDefaultSize = 40 WHERE id = 1; +ALTER TABLE `vn`.`productionConfig` ADD itemPreviousDefaultSize int NULL COMMENT 'Altura por defecto para los artículos de previa'; +UPDATE IGNORE `vn`.`productionConfig` SET itemPreviousDefaultSize = 40 WHERE id = 1; diff --git a/db/changes/240401/01-supplierAccount.sql b/db/changes/240401/01-supplierAccount.sql index 1c0f1ef43..21ce7c71e 100644 --- a/db/changes/240401/01-supplierAccount.sql +++ b/db/changes/240401/01-supplierAccount.sql @@ -1,9 +1,9 @@ -UPDATE vn.supplierAccount sa - JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'FR' +UPDATE `vn`.`supplierAccount` sa + JOIN `vn`.`country` c ON sa.countryFk = c.id AND c.code = 'FR' SET countryFk = c.id WHERE iban = 'FR7630003012690002801121597'; -UPDATE vn.supplierAccount sa - JOIN vn.country c ON sa.countryFk = c.id AND c.code = 'PT' +UPDATE `vn`.`supplierAccount` sa + JOIN `vn`.`country` c ON sa.countryFk = c.id AND c.code = 'PT' SET countryFk = c.id WHERE iban = 'PT50001000005813059150168'; diff --git a/db/changes/240401/02-invoiceOutConfig_refLen.sql b/db/changes/240401/02-invoiceOutConfig_refLen.sql index 8b91889f2..a5f5c2088 100644 --- a/db/changes/240401/02-invoiceOutConfig_refLen.sql +++ b/db/changes/240401/02-invoiceOutConfig_refLen.sql @@ -1,2 +1,2 @@ -ALTER TABLE vn.invoiceOutConfig +ALTER TABLE `vn`.`invoiceOutConfig` ADD IF NOT EXISTS refLen TINYINT UNSIGNED DEFAULT 5 NOT NULL COMMENT 'Invoice reference identifier length'; diff --git a/loopback/server/connectors/vn-mysql.js b/loopback/server/connectors/vn-mysql.js index 40ad78bde..1f7169501 100644 --- a/loopback/server/connectors/vn-mysql.js +++ b/loopback/server/connectors/vn-mysql.js @@ -270,8 +270,8 @@ class VnMySQL extends MySQL { isLoggable(model) { const Model = this.getModelDefinition(model).model; - const settings = Model.definition.settings; - return settings.base && settings.base === 'Loggable'; + const {settings} = Model.definition; + return settings?.mixins?.Loggable; } invokeMethod(method, args, model, ctx, opts, cb) { @@ -291,7 +291,7 @@ class VnMySQL extends MySQL { } try { - const userId = opts.httpCtx && opts.httpCtx.active.accessToken.userId; + const userId = opts.httpCtx && opts.httpCtx.active?.accessToken?.userId; if (userId) { const user = await Model.app.models.VnUser.findById(userId, {fields: ['name']}, opts); await this.executeP(`CALL account.myUser_loginWithName(?)`, [user.name], opts);