Skip to content

Commit

Permalink
feat(orga): added campaignParticipationId attribute / column in share…
Browse files Browse the repository at this point in the history
…d, lib and scripts
  • Loading branch information
alicegoarnisson committed Dec 18, 2024
1 parent ee25fd7 commit 0f3b722
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ const findMultipleUsersFromUserIdsAndSnappedAtDates = async function (userIdsAnd
});

const results = await knex
.select('userId', 'snapshot', 'snappedAt')
.select('userId', 'snapshot', 'snappedAt', 'campaignParticipationId')
.from('knowledge-element-snapshots')
.whereIn(['knowledge-element-snapshots.userId', 'snappedAt'], params);

Expand All @@ -89,6 +89,7 @@ const findMultipleUsersFromUserIdsAndSnappedAtDates = async function (userIdsAnd
userId: result.userId,
snappedAt: result.snappedAt,
knowledgeElements: mappedKnowledgeElements,
campaignParticipationId: result.campaignParticipationId,
});
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ async function generateKnowledgeElementSnapshots(
limitDate: sharedAt,
});
try {
await dependencies.knowledgeElementSnapshotRepository.save({ userId, snappedAt: sharedAt, knowledgeElements });
await dependencies.knowledgeElementSnapshotRepository.save({
userId,
snappedAt: sharedAt,
knowledgeElements,
campainParticipationId: campaignParticipation.id,
});
} catch (err) {
if (!(err instanceof AlreadyExistingEntityError)) {
throw err;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
class CampaignParticipationKnowledgeElementSnapshots {
constructor({ userId, snappedAt, knowledgeElements } = {}) {
constructor({ userId, snappedAt, knowledgeElements, campaignParticipationId } = {}) {
this.userId = userId;
this.snappedAt = snappedAt;
this.knowledgeElements = knowledgeElements;
this.campaginParticipationId = campaignParticipationId;
}
}

Expand Down

0 comments on commit 0f3b722

Please sign in to comment.