refs #5541 Custom user field
gitea/mylogger/pipeline/head This commit looks good Details

This commit is contained in:
Juan Ferrer 2023-04-13 18:31:43 +02:00
parent c007d316e8
commit c3c5d2118e
4 changed files with 14 additions and 4 deletions

View File

@ -19,6 +19,8 @@ dstDb:
user: root user: root
password: password password: password
database: util database: util
userField:
- editorFk
showFields: showFields:
- name - name
- description - description
@ -27,7 +29,7 @@ castTypes:
tinyint: boolean tinyint: boolean
logs: logs:
item: item:
logTable: vn.itemLog logTable: itemLog
mainTable: item mainTable: item
tables: tables:
- name: item - name: item

View File

@ -77,6 +77,7 @@ module.exports = class MyLogger {
showField, showField,
relation, relation,
idName, idName,
userField: tableConf.userField || conf.userField
}); });
return tableInfo; return tableInfo;
@ -199,7 +200,7 @@ module.exports = class MyLogger {
); );
for (const {col, type, def} of dbCols) { for (const {col, type, def} of dbCols) {
if (!tableInfo.exclude.has(col) && col != 'editorFk') if (!tableInfo.exclude.has(col) && col != tableInfo.userField)
tableInfo.columns.set(col, {type, def}); tableInfo.columns.set(col, {type, def});
const castType = conf.castTypes[type]; const castType = conf.castTypes[type];
@ -653,7 +654,7 @@ module.exports = class MyLogger {
if (!isDelete || !deleteRow) { if (!isDelete || !deleteRow) {
await logInfo.addStmt.execute([ await logInfo.addStmt.execute([
originFk, originFk,
row.editorFk || null, row[tableInfo.userField] || null,
action, action,
created, created,
modelName, modelName,

7
package-lock.json generated
View File

@ -1,13 +1,20 @@
{ {
"name": "mylogger", "name": "mylogger",
"version": "0.1.10",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "mylogger",
"version": "0.1.10",
"license": "GPL-3.0",
"dependencies": { "dependencies": {
"colors": "^1.4.0", "colors": "^1.4.0",
"mysql2": "^2.3.3", "mysql2": "^2.3.3",
"require-yaml": "^0.0.1" "require-yaml": "^0.0.1"
},
"engines": {
"node": ">=14"
} }
}, },
"../zongji": { "../zongji": {

View File

@ -1,6 +1,6 @@
{ {
"name": "mylogger", "name": "mylogger",
"version": "0.1.9", "version": "0.1.10",
"author": "Verdnatura Levante SL", "author": "Verdnatura Levante SL",
"description": "MySQL and MariaDB logger using binary log", "description": "MySQL and MariaDB logger using binary log",
"license": "GPL-3.0", "license": "GPL-3.0",