diff --git a/back/models/vn-role.json b/back/models/vn-role.json index c7d7e172b..97bab481f 100644 --- a/back/models/vn-role.json +++ b/back/models/vn-role.json @@ -1,12 +1,30 @@ { "name": "VnRole", "base": "Role", - "validateUpsert": true, + "validateUpsert": true, "options": { - "mysql": { - "table": "account.role" - } - }, + "mysql": { + "table": "account.role" + } + }, + "log": { + "schema": "account", + "logTable": "roleLog", + "mainTable": "role", + "tables": [ + { + "name": "role", + "exclude": [ + "modified" + ] + }, + { + "name": "roleInherit", + "relation": "role", + "showRelation": "inheritsFrom" + } + ] + }, "mixins": { "Loggable": true } diff --git a/back/models/vn-user.json b/back/models/vn-user.json index 5f6ac3f47..2ef7af98b 100644 --- a/back/models/vn-user.json +++ b/back/models/vn-user.json @@ -10,6 +10,34 @@ "mixins": { "Loggable": true }, + "log": { + "schema": "account", + "logTable": "userLog", + "mainTable": "user", + "tables": [ + { + "name": "user", + "modelName": "VnUser", + "exclude": [ + "bcryptPassword", + "password", + "verificationToken" + ] + }, + { + "name": "account", + "relation": "id" + }, + { + "name": "mailAliasAccount", + "relation": "account" + }, + { + "name": "mailForward", + "relation": "account" + } + ] + }, "resetPasswordTokenTTL": "604800", "properties": { "id": { diff --git a/loopback/common/methods/schema/log-info.js b/loopback/common/methods/schema/log-info.js new file mode 100644 index 000000000..67eea250a --- /dev/null +++ b/loopback/common/methods/schema/log-info.js @@ -0,0 +1,47 @@ +const path = require('path'); +const fs = require('fs'); +const BACK_MODELS = `back/models`; +const FILE_EXTENSION = '.json'; +const FILE_ENCODING = 'utf-8'; +module.exports = Self => { + Self.remoteMethod('logInfo', { + description: 'Gets all models information', + accepts: [], + returns: { + type: 'Object', + root: true + }, + http: { + path: `/logInfo`, + verb: 'GET' + } + }); + + const modelsLocale = new Map(); + const modulesDir = path.resolve(`${process.cwd()}/modules`); + const modules = fs.readdirSync(modulesDir); + + for (const mod of modules) { + const modelsDir = path.join(modulesDir, mod, BACK_MODELS); + if (!fs.existsSync(modelsDir)) continue; + handleModels(modelsDir); + } + const pathVn = path.join(process.cwd(), BACK_MODELS); + handleModels(pathVn); + + Self.logInfo = async function() { + return Object.fromEntries(modelsLocale); + }; + + function handleModels(modelsDir) { + const models = (fs.readdirSync(modelsDir)).filter(fileName => fileName.endsWith(FILE_EXTENSION)); + for (const model of models) { + const modelFile = path.join(modelsDir, model); + const modelConfig = JSON.parse(fs.readFileSync(modelFile, {encoding: FILE_ENCODING})); + const {log} = modelConfig; + if (!log?.mainTable) continue; + const key = modelConfig.name.startsWith('Vn') ? modelConfig.name.slice(2) : modelConfig.name; + modelsLocale.set(key.toLowerCase(), log); + } + } +}; diff --git a/loopback/common/models/application.js b/loopback/common/models/application.js index 6bdc2c13a..c4b5c1f5e 100644 --- a/loopback/common/models/application.js +++ b/loopback/common/models/application.js @@ -6,4 +6,5 @@ module.exports = function(Self) { require('../methods/application/executeProc')(Self); require('../methods/application/executeFunc')(Self); require('../methods/application/getEnumValues')(Self); + require('../methods/application/getEnumValues')(Self); }; diff --git a/loopback/common/models/schema.js b/loopback/common/models/schema.js index f88cc895c..4734a40a0 100644 --- a/loopback/common/models/schema.js +++ b/loopback/common/models/schema.js @@ -1,4 +1,5 @@ module.exports = function(Self) { require('../methods/schema/model-info')(Self); + require('../methods/schema/log-info')(Self); }; diff --git a/loopback/common/models/schema.json b/loopback/common/models/schema.json index 1bdf0fcf7..cfdacdf3f 100644 --- a/loopback/common/models/schema.json +++ b/loopback/common/models/schema.json @@ -7,6 +7,12 @@ "principalType": "ROLE", "principalId": "$everyone", "permission": "ALLOW" + }, + { + "property": "logInfo", + "principalType": "ROLE", + "principalId": "$everyone", + "permission": "ALLOW" } ] -} \ No newline at end of file +} diff --git a/modules/claim/back/models/claim.json b/modules/claim/back/models/claim.json index 1fc88df1c..a1304fe87 100644 --- a/modules/claim/back/models/claim.json +++ b/modules/claim/back/models/claim.json @@ -4,6 +4,20 @@ "mixins": { "Loggable": true }, + "log": { + "logTable": "claimLog", + "mainTable": "claim", + "tables": [ + { + "name": "claimDms", + "idName": "dmsFk" + }, + "claimDevelopment", + "claimBeginning", + "claimEnd", + "claimObservation" + ] + }, "options": { "mysql": { "table": "claim" diff --git a/modules/client/back/models/client.json b/modules/client/back/models/client.json index 550ac380e..94f63dc61 100644 --- a/modules/client/back/models/client.json +++ b/modules/client/back/models/client.json @@ -1,267 +1,304 @@ { - "name": "Client", - "base": "VnModel", + "name": "Client", + "base": "VnModel", "mixins": { "Loggable": true }, - "options": { - "mysql": { - "table": "client" - } - }, - "properties": { - "id": { - "type": "number", - "id": true, - "description": "Identifier" - }, - "name": { - "type": "string", - "required": true - }, - "fi": { - "type": "string", - "description": "Fiscal indentifier" - }, - "socialName": { - "type": "string", - "required": true - }, - "contact": { - "type": "string" - }, - "street": { - "type": "string", - "required": true - }, - "city": { - "type": "string", - "required": true - }, - "postcode": { - "type": "string" - }, - "email": { - "type": "string" - }, - "phone": { - "type": "string" - }, - "mobile": { - "type": "string" - }, - "isActive": { - "type": "boolean" - }, - "credit": { - "type": "number" - }, - "creditInsurance": { - "type": "number" - }, - "iban": { - "type": "string" - }, - "dueDay": { - "type": "number" - }, - "isEqualizated": { - "type": "boolean", - "description": "The client has equalization tax" - }, - "isFreezed": { - "type": "boolean", - "description": "The client frozen" - }, - "hasToInvoiceByAddress": { - "type": "boolean", - "description": "The client has to be invoiced by address" - }, - "hasToInvoice": { - "type": "boolean", - "description": "Global invoicing enabled for the client" - }, - "isToBeMailed": { - "type": "boolean", - "description": "Send invoices by email" - }, - "hasSepaVnl": { - "type": "boolean" - }, - "hasLcr": { - "type": "boolean" - }, - "hasCoreVnl": { - "type": "boolean" - }, - "hasCoreVnh": { - "type": "boolean" - }, - "hasIncoterms": { - "type": "boolean" - }, - "isTaxDataChecked":{ - "type": "boolean" - }, - "eypbc": { - "type": "boolean" - }, - "quality": { - "type": "number" - }, - "isVies": { - "type": "boolean" - }, - "isRelevant": { - "type": "boolean" - }, - "accountingAccount": { - "type": "string" - }, - "created": { - "type": "date" - }, - "sageTaxTypeFk": { - "type": "number", - "mysql": { - "columnName": "taxTypeSageFk" - } - }, - "sageTransactionTypeFk": { - "type": "number", - "mysql": { - "columnName": "transactionTypeSageFk" - } - }, - "businessTypeFk": { - "type": "string", - "mysql": { - "columnName": "businessTypeFk" - } - }, - "salesPersonFk": { - "type": "number" - }, - "hasElectronicInvoice": { - "type": "boolean" - }, - "rating": { - "type": "number" - }, - "recommendedCredit": { - "type": "number" - } - - }, - "relations": { - "account": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "id" - }, - "user": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "id" - }, - "payMethod": { - "type": "belongsTo", - "model": "PayMethod", - "foreignKey": "payMethodFk" - }, - "salesPersonUser": { - "type": "belongsTo", - "model": "VnUser", - "foreignKey": "salesPersonFk" - }, - "province": { - "type": "belongsTo", - "model": "Province", - "foreignKey": "provinceFk" - }, - "country": { - "type": "belongsTo", - "model": "Country", - "foreignKey": "countryFk" - }, + "options": { + "mysql": { + "table": "client" + } + }, + "log": { + "logTable": "clientLog", + "mainTable": "client", + "tables": [ + "address", + { + "name": "client", + "types": { + "payMethodFk": "integer" + }, + "exclude": [ + "defaultAddressFk" + ] + }, + { + "name": "clientContact", + "relation": "clientFk" + }, + "clientDms", + "clientObservation", + { + "name": "clientSample", + "relation": "clientFk" + }, + { + "name": "greuge", + "relation": "clientFk" + }, + { + "name": "recovery", + "relation": "clientFk" + }, + { + "name": "clientUnpaid", + "relation": "clientFk" + } + ] + }, + "properties": { + "id": { + "type": "number", + "id": true, + "description": "Identifier" + }, + "name": { + "type": "string", + "required": true + }, + "fi": { + "type": "string", + "description": "Fiscal indentifier" + }, + "socialName": { + "type": "string", + "required": true + }, + "contact": { + "type": "string" + }, + "street": { + "type": "string", + "required": true + }, + "city": { + "type": "string", + "required": true + }, + "postcode": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string" + }, + "mobile": { + "type": "string" + }, + "isActive": { + "type": "boolean" + }, + "credit": { + "type": "number" + }, + "creditInsurance": { + "type": "number" + }, + "iban": { + "type": "string" + }, + "dueDay": { + "type": "number" + }, + "isEqualizated": { + "type": "boolean", + "description": "The client has equalization tax" + }, + "isFreezed": { + "type": "boolean", + "description": "The client frozen" + }, + "hasToInvoiceByAddress": { + "type": "boolean", + "description": "The client has to be invoiced by address" + }, + "hasToInvoice": { + "type": "boolean", + "description": "Global invoicing enabled for the client" + }, + "isToBeMailed": { + "type": "boolean", + "description": "Send invoices by email" + }, + "hasSepaVnl": { + "type": "boolean" + }, + "hasLcr": { + "type": "boolean" + }, + "hasCoreVnl": { + "type": "boolean" + }, + "hasCoreVnh": { + "type": "boolean" + }, + "hasIncoterms": { + "type": "boolean" + }, + "isTaxDataChecked": { + "type": "boolean" + }, + "eypbc": { + "type": "boolean" + }, + "quality": { + "type": "number" + }, + "isVies": { + "type": "boolean" + }, + "isRelevant": { + "type": "boolean" + }, + "accountingAccount": { + "type": "string" + }, + "created": { + "type": "date" + }, + "sageTaxTypeFk": { + "type": "number", + "mysql": { + "columnName": "taxTypeSageFk" + } + }, + "sageTransactionTypeFk": { + "type": "number", + "mysql": { + "columnName": "transactionTypeSageFk" + } + }, + "businessTypeFk": { + "type": "string", + "mysql": { + "columnName": "businessTypeFk" + } + }, + "salesPersonFk": { + "type": "number" + }, + "hasElectronicInvoice": { + "type": "boolean" + }, + "rating": { + "type": "number" + }, + "recommendedCredit": { + "type": "number" + } + }, + "relations": { + "account": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "id" + }, + "user": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "id" + }, + "payMethod": { + "type": "belongsTo", + "model": "PayMethod", + "foreignKey": "payMethodFk" + }, + "salesPersonUser": { + "type": "belongsTo", + "model": "VnUser", + "foreignKey": "salesPersonFk" + }, + "province": { + "type": "belongsTo", + "model": "Province", + "foreignKey": "provinceFk" + }, + "country": { + "type": "belongsTo", + "model": "Country", + "foreignKey": "countryFk" + }, "isSocialNameUnique": { "type": "belongsTo", "model": "Country", "foreignKey": "countryFk" }, - "contactChannel": { - "type": "belongsTo", - "model": "ContactChannel", - "foreignKey": "contactChannelFk" - }, - "type": { - "type": "belongsTo", - "model": "ClientType", - "foreignKey": "typeFk" - }, - "businessType": { - "type": "belongsTo", - "model": "BusinessType", - "foreignKey": "businessTypeFk" - }, - "addresses": { - "type": "hasMany", - "model": "Address", - "foreignKey": "clientFk" - }, - "greuge": { - "type": "hasMany", - "model": "Greuge", - "foreignKey": "clientFk" - }, - "classifications": { - "type": "hasMany", - "model": "CreditClassification", - "foreignKey": "client" - }, - "defaultAddress": { - "type": "belongsTo", - "model": "Address", - "foreignKey": "defaultAddressFk" - }, - "contacts": { - "type": "hasMany", - "model": "ClientContact", - "foreignKey": "clientFk" - }, - "bank": { - "type": "belongsTo", - "model": "BankEntity", - "foreignKey": "bankEntityFk" - }, - "defaulters": { - "type": "hasMany", - "model": "Defaulter", - "foreignKey": "clientFk" - }, - "clientRisks": { - "type": "hasMany", - "model": "ClientRisk", - "foreignKey": "clientFk" - }, - "claimsRatio": { - "type": "hasOne", - "model": "ClaimRatio", - "foreignKey": "clientFk" - }, - "transferor": { - "type": "belongsTo", - "model": "Client", - "foreignKey": "transferorFk" - }, - "supplier": { + "contactChannel": { + "type": "belongsTo", + "model": "ContactChannel", + "foreignKey": "contactChannelFk" + }, + "type": { + "type": "belongsTo", + "model": "ClientType", + "foreignKey": "typeFk" + }, + "businessType": { + "type": "belongsTo", + "model": "BusinessType", + "foreignKey": "businessTypeFk" + }, + "addresses": { + "type": "hasMany", + "model": "Address", + "foreignKey": "clientFk" + }, + "greuge": { + "type": "hasMany", + "model": "Greuge", + "foreignKey": "clientFk" + }, + "classifications": { + "type": "hasMany", + "model": "CreditClassification", + "foreignKey": "client" + }, + "defaultAddress": { + "type": "belongsTo", + "model": "Address", + "foreignKey": "defaultAddressFk" + }, + "contacts": { + "type": "hasMany", + "model": "ClientContact", + "foreignKey": "clientFk" + }, + "bank": { + "type": "belongsTo", + "model": "BankEntity", + "foreignKey": "bankEntityFk" + }, + "defaulters": { + "type": "hasMany", + "model": "Defaulter", + "foreignKey": "clientFk" + }, + "clientRisks": { + "type": "hasMany", + "model": "ClientRisk", + "foreignKey": "clientFk" + }, + "claimsRatio": { + "type": "hasOne", + "model": "ClaimRatio", + "foreignKey": "clientFk" + }, + "transferor": { + "type": "belongsTo", + "model": "Client", + "foreignKey": "transferorFk" + }, + "supplier": { "type": "belongsTo", "model": "Supplier", "foreignKey": "fi", "primaryKey": "nif" } - }, - "scopes": { + }, + "scopes": { "isActive": { "where": { "isActive": { diff --git a/modules/entry/back/models/entry.json b/modules/entry/back/models/entry.json index ab451219e..c2e13afc2 100644 --- a/modules/entry/back/models/entry.json +++ b/modules/entry/back/models/entry.json @@ -9,6 +9,14 @@ "table": "entry" } }, + "log": { + "logTable": "entryLog", + "mainTable": "entry", + "tables": [ + "buy", + "entryObservation" + ] + }, "properties": { "id": { "type": "number", @@ -35,9 +43,9 @@ }, "isVirtual": { "type": "boolean", - "mysql": { - "columnName": "isRaid" - } + "mysql": { + "columnName": "isRaid" + } }, "isRaid": { "type": "boolean" @@ -53,9 +61,9 @@ }, "observation": { "type": "string", - "mysql": { - "columnName": "evaNotes" - } + "mysql": { + "columnName": "evaNotes" + } }, "loadPriority": { "type": "number" diff --git a/modules/invoiceIn/back/models/invoice-in.json b/modules/invoiceIn/back/models/invoice-in.json index 9614c3872..d40c0c52d 100644 --- a/modules/invoiceIn/back/models/invoice-in.json +++ b/modules/invoiceIn/back/models/invoice-in.json @@ -9,6 +9,14 @@ "table": "invoiceIn" } }, + "log": { + "logTable": "invoiceInLog", + "mainTable": "invoiceIn", + "tables": [ + "invoiceInDueDay", + "invoiceInTax" + ] + }, "properties": { "id": { "id": true, @@ -111,5 +119,3 @@ } } } - - diff --git a/modules/item/back/models/item.json b/modules/item/back/models/item.json index 9d48dcbfb..d87c3698e 100644 --- a/modules/item/back/models/item.json +++ b/modules/item/back/models/item.json @@ -9,6 +9,48 @@ "table": "item" } }, + "log": { + "logTable": "itemLog", + "mainTable": "item", + "tables": [ + "itemBarcode", + "itemBotanical", + { + "name": "itemTag", + "showRelation": "tagFk" + }, + { + "name": "itemTaxCountry", + "types": { + "taxClassFk": "integer" + } + }, + { + "name": "item", + "showField": "name", + "exclude": [ + "lastUsed", + "supplyResponseFk", + "tag5", + "tag6", + "tag7", + "tag8", + "tag9", + "tag10", + "value5", + "value6", + "value7", + "value8", + "value9", + "value10", + "image" + ], + "logFields":[ + "size" + ] + } + ] + }, "properties": { "id": { "type": "number", @@ -223,4 +265,4 @@ } } } -} \ No newline at end of file +} diff --git a/modules/route/back/models/route.json b/modules/route/back/models/route.json index f8be9023c..b111c762a 100644 --- a/modules/route/back/models/route.json +++ b/modules/route/back/models/route.json @@ -1,6 +1,6 @@ { "name": "Route", - "base": "VnModel", + "base": "VnModel", "mixins": { "Loggable": true }, @@ -9,6 +9,16 @@ "table": "route" } }, + "log": { + "logTable": "routeLog", + "mainTable": "route", + "tables": [ + { + "name": "routesMonitor", + "relation": "routeFk" + } + ] + }, "properties": { "id": { "type": "number", @@ -70,13 +80,13 @@ "type": "belongsTo", "model": "AgencyMode", "foreignKey": "agencyModeFk" - }, - "ticket": { - "type": "hasMany", - "model": "Ticket", - "foreignKey": "routeFk" - }, - "zone": { + }, + "ticket": { + "type": "hasMany", + "model": "Ticket", + "foreignKey": "routeFk" + }, + "zone": { "type": "belongsTo", "model": "Zone", "foreignKey": "zoneFk" diff --git a/modules/shelving/back/models/parking.json b/modules/shelving/back/models/parking.json index 47a3305ae..6b6ea4649 100644 --- a/modules/shelving/back/models/parking.json +++ b/modules/shelving/back/models/parking.json @@ -1,11 +1,18 @@ { "name": "Parking", - "base": "VnModel", + "base": "VnModel", "options": { "mysql": { "table": "parking" } }, + "log": { + "logTable": "parkingLog", + "mainTable": "parking", + "tables": [ + "saleGroup" + ] + }, "properties": { "id": { "type": "number", diff --git a/modules/shelving/back/models/shelving.json b/modules/shelving/back/models/shelving.json index 46fce31e8..a2a03f80e 100644 --- a/modules/shelving/back/models/shelving.json +++ b/modules/shelving/back/models/shelving.json @@ -1,6 +1,6 @@ { "name": "Shelving", - "base": "VnModel", + "base": "VnModel", "mixins": { "Loggable": true }, @@ -9,6 +9,10 @@ "table": "shelving" } }, + "log": { + "logTable": "shelvingLog", + "mainTable": "shelving" + }, "properties": { "id": { "type": "number", diff --git a/modules/supplier/back/models/supplier.json b/modules/supplier/back/models/supplier.json index 90b266ba9..de2eabd86 100644 --- a/modules/supplier/back/models/supplier.json +++ b/modules/supplier/back/models/supplier.json @@ -9,6 +9,31 @@ "table": "supplier" } }, + "log": { + "logTable": "supplierLog", + "mainTable": "supplier", + "tables": [ + { + "name": "supplier", + "types": { + "payMethodFk": "integer" + } + }, + { + "name": "supplierAccount", + "showField": "iban" + }, + { + "name": "supplierAddress", + "relation": "supplierFk" + }, + "supplierContact", + { + "name": "supplierDms", + "idName": "supplierFk" + } + ] + }, "properties": { "id": { "type": "number", @@ -85,23 +110,23 @@ "type": "number" }, "sageTaxTypeFk": { - "type": "number", - "mysql": { - "columnName": "taxTypeSageFk" - } - }, - "sageTransactionTypeFk": { - "type": "number", - "mysql": { - "columnName": "transactionTypeSageFk" - } - }, + "type": "number", + "mysql": { + "columnName": "taxTypeSageFk" + } + }, + "sageTransactionTypeFk": { + "type": "number", + "mysql": { + "columnName": "transactionTypeSageFk" + } + }, "sageWithholdingFk": { - "type": "number", - "mysql": { - "columnName": "withholdingSageFk" - } - }, + "type": "number", + "mysql": { + "columnName": "withholdingSageFk" + } + }, "isPayMethodChecked": { "type": "boolean" }, @@ -116,26 +141,26 @@ } }, "relations": { - "payMethod": { - "type": "belongsTo", - "model": "PayMethod", - "foreignKey": "payMethodFk" - }, + "payMethod": { + "type": "belongsTo", + "model": "PayMethod", + "foreignKey": "payMethodFk" + }, "payDem": { "type": "belongsTo", "model": "PayDem", "foreignKey": "payDemFk" }, - "province": { - "type": "belongsTo", - "model": "Province", - "foreignKey": "provinceFk" - }, - "country": { - "type": "belongsTo", - "model": "Country", - "foreignKey": "countryFk" - }, + "province": { + "type": "belongsTo", + "model": "Province", + "foreignKey": "provinceFk" + }, + "country": { + "type": "belongsTo", + "model": "Country", + "foreignKey": "countryFk" + }, "client": { "type": "belongsTo", "model": "Client", @@ -147,35 +172,35 @@ "model": "Worker", "foreignKey": "workerFk" }, - "sageTaxType": { - "type": "belongsTo", - "model": "SageTaxType", + "sageTaxType": { + "type": "belongsTo", + "model": "SageTaxType", "foreignKey": "sageTaxTypeFk" - }, - "sageTransactionType": { - "type": "belongsTo", - "model": "SageTransactionType", - "foreignKey": "sageTransactionTypeFk" - }, - "sageWithholding": { - "type": "belongsTo", - "model": "SageWithholding", - "foreignKey": "sageWithholdingFk" - }, + }, + "sageTransactionType": { + "type": "belongsTo", + "model": "SageTransactionType", + "foreignKey": "sageTransactionTypeFk" + }, + "sageWithholding": { + "type": "belongsTo", + "model": "SageWithholding", + "foreignKey": "sageWithholdingFk" + }, "contacts": { - "type": "hasMany", - "model": "SupplierContact", + "type": "hasMany", + "model": "SupplierContact", "foreignKey": "supplierFk" }, "addresses": { - "type": "hasMany", - "model": "SupplierAddress", - "foreignKey": "supplierFk" - }, - "supplierActivity": { - "type": "belongsTo", - "model": "SupplierActivity", - "foreignKey": "supplierActivityFk" - } + "type": "hasMany", + "model": "SupplierAddress", + "foreignKey": "supplierFk" + }, + "supplierActivity": { + "type": "belongsTo", + "model": "SupplierActivity", + "foreignKey": "supplierActivityFk" + } } } diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index 248c0312f..43aa972c6 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -1,14 +1,69 @@ { "name": "Ticket", - "base": "VnModel", + "base": "VnModel", "mixins": { "Loggable": true }, "options": { "mysql": { - "table": "ticket" + "table": "ticket" } }, + "log": { + "logTable": "ticketLog", + "mainTable": "ticket", + "tables": [ + "expedition", + { + "name": "sale", + "showField": "concept", + "types": { + "discount": "integer" + }, + "exclude": [ + "priceFixed" + ] + }, + { + "name": "ticket", + "types": { + "priority": "integer" + }, + "exclude": [ + "totalWithVat", + "totalWithoutVat" + ] + }, + { + "name": "ticketDms", + "idName": "dmsFk" + }, + { + "name": "ticketObservation", + "types": { + "observationTypeFk": "integer" + } + }, + "ticketPackaging", + { + "name": "ticketRefund", + "relation": "originalTicketFk" + }, + "ticketRequest", + "ticketService", + { + "name": "ticketTracking", + "showRelation": "stateFk", + "types": { + "stateFk": "integer" + }, + "exclude": [ + "failFk" + ] + }, + "ticketWeekly" + ] + }, "properties": { "id": { "id": true, diff --git a/modules/travel/back/models/travel.json b/modules/travel/back/models/travel.json index 701894a76..b77b07d10 100644 --- a/modules/travel/back/models/travel.json +++ b/modules/travel/back/models/travel.json @@ -1,6 +1,6 @@ { "name": "Travel", - "base": "VnModel", + "base": "VnModel", "mixins": { "Loggable": true }, @@ -9,6 +9,23 @@ "table": "travel" } }, + "log": { + "logTable": "travelLog", + "mainTable": "travel", + "tables": [ + { + "name": "travel", + "showField": "ref", + "types": { + "totalEntries": "integer" + } + }, + { + "name": "travelThermograph", + "showField": "thermographFk" + } + ] + }, "properties": { "id": { "type": "number", diff --git a/modules/worker/back/models/device-production.json b/modules/worker/back/models/device-production.json index f6e5105ad..230d128ed 100644 --- a/modules/worker/back/models/device-production.json +++ b/modules/worker/back/models/device-production.json @@ -5,7 +5,11 @@ "Loggable": true }, "log": { - "model": "DeviceProductionLog" + "logTable": "deviceProductionLog", + "mainTable": "deviceProduction", + "tables": [ + "deviceProductionUser" + ] }, "options": { "mysql": { @@ -24,25 +28,25 @@ "type": "number" }, "macWifi": { - "type" : "string" + "type": "string" }, "serialNumber": { - "type" : "string" + "type": "string" }, "android_id": { - "type" : "string" + "type": "string" }, "purchased": { - "type" : "date" + "type": "date" }, "stateFk": { - "type" : "string" + "type": "string" }, "isInScaleFusion": { - "type" : "boolean" + "type": "boolean" }, "description": { - "type" : "string" + "type": "string" } }, "relations": { diff --git a/modules/worker/back/models/worker.json b/modules/worker/back/models/worker.json index c203f6e09..616ae5b5d 100644 --- a/modules/worker/back/models/worker.json +++ b/modules/worker/back/models/worker.json @@ -10,6 +10,30 @@ "table": "worker" } }, + "log": { + "logTable": "workerLog", + "mainTable": "worker", + "tables": [ + { + "name": "worker", + "showField": "firstName", + "exclude": [ + "balance" + ] + }, + { + "name": "workerDocument", + "showRelation": "document", + "modelName": "WorkerDms", + "relation": "worker" + }, + "business", + { + "name": "workerTimeControl", + "relation": "userFk" + } + ] + }, "properties": { "id": { "type": "number", @@ -25,40 +49,40 @@ "required": true }, "phone": { - "type" : "string" + "type": "string" }, "bossFk": { - "type" : "number" + "type": "number" }, "maritalStatus": { - "type" : "string" + "type": "string" }, "originCountryFk": { - "type" : "number" + "type": "number" }, "educationLevelFk": { - "type" : "number" + "type": "number" }, "SSN": { - "type" : "string" + "type": "string" }, "mobileExtension": { - "type" : "number" + "type": "number" }, "code": { - "type" : "string" + "type": "string" }, "locker": { - "type" : "number" + "type": "number" }, "fi": { - "type" : "string" + "type": "string" }, "birth": { - "type" : "date" + "type": "date" }, "isF11Allowed": { - "type" : "boolean" + "type": "boolean" } }, "relations": { @@ -93,38 +117,51 @@ "foreignKey": "workerFk" } }, - "scopes":{ + "scopes": { "summary": { "include": [ { "relation": "user", "scope": { - "fields": ["email", "name", "nickname", "roleFk", "emailVerified"], + "fields": [ + "email", + "name", + "nickname", + "roleFk", + "emailVerified" + ], "include": [ { "relation": "role", "scope": { - "fields": ["name"] + "fields": [ + "name" + ] } }, { "relation": "emailUser", "scope": { - "fields": ["email"] + "fields": [ + "email" + ] } } ] } - }, { + }, + { "relation": "department", "scope": { "include": { "relation": "department" } } - }, { + }, + { "relation": "boss" - }, { + }, + { "relation": "client", "scope": { "fields": [ @@ -169,7 +206,8 @@ "recommendedCredit" ] } - }, { + }, + { "relation": "sip" } ] diff --git a/modules/zone/back/models/zone.json b/modules/zone/back/models/zone.json index cf7371053..5105c9bdd 100644 --- a/modules/zone/back/models/zone.json +++ b/modules/zone/back/models/zone.json @@ -1,74 +1,87 @@ { - "name": "Zone", - "base": "VnModel", + "name": "Zone", + "base": "VnModel", "mixins": { "Loggable": true }, - "options": { - "mysql": { - "table": "zone" - } - }, - "properties": { - "id": { - "id": true, - "type": "number" - }, - "name": { - "type": "string", - "required": true - }, - "hour": { - "type": "date", - "required": true - }, - "travelingDays": { - "type": "number" - }, - "price": { - "type": "number" - }, - "bonus": { - "type": "number" - }, - "isVolumetric": { - "type": "boolean" - }, - "inflation": { - "type": "number" - }, - "m3Max": { - "type": "number" - }, - "itemMaxSize": { - "type": "number" - } - }, - "relations": { + "options": { + "mysql": { + "table": "zone" + } + }, + "log": { + "logTable": "zoneLog", + "mainTable": "zone", + "tables": [ + "zoneEvent", + "zoneExclusion", + "zoneWarehouse", + { + "name": "zoneIncluded", + "idName": "zoneFk" + } + ] + }, + "properties": { + "id": { + "id": true, + "type": "number" + }, + "name": { + "type": "string", + "required": true + }, + "hour": { + "type": "date", + "required": true + }, + "travelingDays": { + "type": "number" + }, + "price": { + "type": "number" + }, + "bonus": { + "type": "number" + }, + "isVolumetric": { + "type": "boolean" + }, + "inflation": { + "type": "number" + }, + "m3Max": { + "type": "number" + }, + "itemMaxSize": { + "type": "number" + } + }, + "relations": { "agencyMode": { "type": "belongsTo", "model": "AgencyMode", "foreignKey": "agencyModeFk" - }, - "events": { + }, + "events": { "type": "hasMany", "model": "ZoneEvent", "foreignKey": "zoneFk" }, - "exclusions": { + "exclusions": { "type": "hasMany", "model": "ZoneExclusion", - "foreignKey": "zoneFk" - }, - "warehouses": { - "type": "hasMany", - "model": "ZoneWarehouse", - "foreignKey": "zoneFk" + "foreignKey": "zoneFk" }, - "closures": { - "type": "hasMany", - "model": "ZoneClosure", - "foreignKey": "zoneFk" + "warehouses": { + "type": "hasMany", + "model": "ZoneWarehouse", + "foreignKey": "zoneFk" + }, + "closures": { + "type": "hasMany", + "model": "ZoneClosure", + "foreignKey": "zoneFk" } } }