From 15875305fb70f545e00601ce446d6447bb422468 Mon Sep 17 00:00:00 2001 From: Leonardo Viva Date: Thu, 12 Sep 2024 13:17:16 -0300 Subject: [PATCH] fix: history created by --- src/imports/konsistent/createHistory.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/imports/konsistent/createHistory.js b/src/imports/konsistent/createHistory.js index ef0bc5d..5fc2725 100644 --- a/src/imports/konsistent/createHistory.js +++ b/src/imports/konsistent/createHistory.js @@ -2,6 +2,7 @@ import { MetaObject } from "@imports/model/MetaObject"; import { logger } from "@imports/utils/logger"; import get from "lodash/get"; import omit from "lodash/omit"; +import pick from "lodash/pick"; import { v4 as uuidV4 } from 'uuid'; export default async function createHistory(metaName, action, id, data, updatedBy, updatedAt, changed) { @@ -37,13 +38,13 @@ export default async function createHistory(metaName, action, id, data, updatedB const historyQuery = { _id: changeId }; - const userDetailFields = ["_id"].concat(get(meta, "fields._user.detailFields", ["name", "active"])); + const userDescriptionFields = ["_id"].concat(get(meta, "fields._user.descriptionFields", ["name", "active"])); // Define base data to history const historyItem = { dataId: id, createdAt: updatedAt, - createdBy: get(updatedBy, userDetailFields), + createdBy: pick(updatedBy, userDescriptionFields), data: historyData, type: action, };