Skip to content

Commit

Permalink
fix: history created by
Browse files Browse the repository at this point in the history
  • Loading branch information
7sete7 committed Sep 12, 2024
1 parent 761db2c commit 1587530
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/imports/konsistent/createHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit 1587530

Please sign in to comment.