From b2951061d3d4695ecd943960175b1ae5da44274d Mon Sep 17 00:00:00 2001 From: alicegoarnisson Date: Wed, 18 Dec 2024 11:43:26 +0100 Subject: [PATCH] feat(orga): added new attribute in builder --- .../factory/build-knowledge-element-snapshot.js | 2 ++ .../factory/knowledge-elements-snapshot-factory.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/api/db/database-builder/factory/build-knowledge-element-snapshot.js b/api/db/database-builder/factory/build-knowledge-element-snapshot.js index 854e6ef788f..1a3888501e8 100644 --- a/api/db/database-builder/factory/build-knowledge-element-snapshot.js +++ b/api/db/database-builder/factory/build-knowledge-element-snapshot.js @@ -9,6 +9,7 @@ const buildKnowledgeElementSnapshot = function ({ userId, snappedAt = new Date('2020-01-01'), snapshot, + campaignParticipationId, } = {}) { const dateMinusOneDay = new Date(snappedAt.getTime() - 1000 * 60 * 60 * 24 * 7); userId = _.isUndefined(userId) ? buildUser().id : userId; @@ -24,6 +25,7 @@ const buildKnowledgeElementSnapshot = function ({ userId, snappedAt, snapshot, + campaignParticipationId, }; return databaseBuffer.pushInsertable({ diff --git a/api/db/database-builder/factory/knowledge-elements-snapshot-factory.js b/api/db/database-builder/factory/knowledge-elements-snapshot-factory.js index d173d79eb95..d6b6c896cf7 100644 --- a/api/db/database-builder/factory/knowledge-elements-snapshot-factory.js +++ b/api/db/database-builder/factory/knowledge-elements-snapshot-factory.js @@ -1,7 +1,7 @@ import { databaseBuffer } from '../database-buffer.js'; import { buildKnowledgeElement } from './build-knowledge-element.js'; -function buildSnapshot({ id, userId, snappedAt, knowledgeElementsAttributes }) { +function buildSnapshot({ id, userId, snappedAt, knowledgeElementsAttributes, campaignParticipationId }) { const knowledgeElements = knowledgeElementsAttributes.map((attributes) => buildKnowledgeElement(attributes)); const values = { @@ -9,6 +9,7 @@ function buildSnapshot({ id, userId, snappedAt, knowledgeElementsAttributes }) { userId, snappedAt, snapshot: JSON.stringify(knowledgeElements), + campaignParticipationId, }; return databaseBuffer.pushInsertable({