Skip to content

Commit 77db09e

Browse files
theotime2005alicegoarnissonxav-car
committed
feat(api): Clean userId and snappedAt on factory build-knowledge-element-snapshots
Co-Authored-By: alicegoarnisson <187311468+alicegoarnisson@users.noreply.github.com> Co-Authored-By: Xavier Carron <33637571+xav-car@users.noreply.github.com>
1 parent f729a34 commit 77db09e

File tree

5 files changed

+0
-25
lines changed

5 files changed

+0
-25
lines changed

api/db/database-builder/factory/build-knowledge-element-snapshot.js

-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import _ from 'lodash';
2-
31
import { KnowledgeElementCollection } from '../../../src/prescription/shared/domain/models/KnowledgeElementCollection.js';
42
import { databaseBuffer } from '../database-buffer.js';
53
import { buildKnowledgeElement } from './build-knowledge-element.js';
6-
import { buildUser } from './build-user.js';
74

85
const buildKnowledgeElementSnapshot = function ({
96
id = databaseBuffer.getNextId(),
10-
userId,
11-
snappedAt = new Date('2020-01-01'),
127
snapshot,
138
campaignParticipationId,
149
} = {}) {
15-
const dateMinusOneDay = new Date(snappedAt.getTime() - 1000 * 60 * 60 * 24 * 7);
16-
userId = _.isUndefined(userId) ? buildUser().id : userId;
1710
if (!snapshot) {
1811
const knowledgeElements = [];
1912
knowledgeElements.push(buildKnowledgeElement({ userId, createdAt: dateMinusOneDay }));
@@ -23,8 +16,6 @@ const buildKnowledgeElementSnapshot = function ({
2316

2417
const values = {
2518
id,
26-
userId,
27-
snappedAt,
2819
snapshot,
2920
campaignParticipationId,
3021
};

api/db/seeds/data/common/tooling/campaign-tooling.js

-4
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ async function createAssessmentCampaign({
238238

239239
if (isShared) {
240240
databaseBuilder.factory.buildKnowledgeElementSnapshot({
241-
userId,
242-
snappedAt: sharedAt,
243241
snapshot: new KnowledgeElementCollection(keDataForSnapshot).toSnapshot(),
244242
campaignParticipationId,
245243
});
@@ -402,8 +400,6 @@ async function createProfilesCollectionCampaign({
402400
);
403401
}
404402
databaseBuilder.factory.buildKnowledgeElementSnapshot({
405-
userId,
406-
snappedAt: sharedAt,
407403
snapshot: new KnowledgeElementCollection(keDataForSnapshot).toSnapshot(),
408404
campaignParticipationId,
409405
});

api/tests/prescription/campaign/acceptance/application/campaign-results-route_test.js

-2
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,8 @@ describe('Acceptance | API | campaign-results-route', function () {
576576
});
577577

578578
databaseBuilder.factory.buildKnowledgeElementSnapshot({
579-
userId,
580579
campaignParticipationId: campaignParticipation.id,
581580
snapshot: new KnowledgeElementCollection([ke]).toSnapshot(),
582-
snappedAt: campaignParticipation.sharedAt,
583581
});
584582

585583
await databaseBuilder.commit();

api/tests/shared/integration/domain/services/placement-profile-service_test.js

-8
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,6 @@ describe('Shared | Integration | Domain | Services | Placement Profile Service',
524524
});
525525

526526
databaseBuilder.factory.buildKnowledgeElementSnapshot({
527-
userId: userId,
528-
snappedAt: sharedAt,
529527
campaignParticipationId: campaignParticipation.id,
530528
snapshot: new KnowledgeElementCollection([ke]).toSnapshot(),
531529
});
@@ -575,8 +573,6 @@ describe('Shared | Integration | Domain | Services | Placement Profile Service',
575573
});
576574

577575
databaseBuilder.factory.buildKnowledgeElementSnapshot({
578-
userId: userId,
579-
snappedAt: sharedAt,
580576
campaignParticipationId: campaignParticipation.id,
581577
snapshot: new KnowledgeElementCollection([ke1, ke2]).toSnapshot(),
582578
});
@@ -604,8 +600,6 @@ describe('Shared | Integration | Domain | Services | Placement Profile Service',
604600

605601
databaseBuilder.factory.buildKnowledgeElementSnapshot({
606602
campaignParticipationId: campaignParticipation.id,
607-
userId: userId,
608-
snappedAt: campaignParticipation.sharedAt,
609603
snapshot: new KnowledgeElementCollection([ke]).toSnapshot(),
610604
});
611605

@@ -639,8 +633,6 @@ describe('Shared | Integration | Domain | Services | Placement Profile Service',
639633

640634
databaseBuilder.factory.buildKnowledgeElementSnapshot({
641635
campaignParticipationId: campaignParticipation.id,
642-
userId: userId,
643-
snappedAt: campaignParticipation.sharedAt,
644636
snapshot: new KnowledgeElementCollection([ke]).toSnapshot(),
645637
});
646638

api/tests/shared/integration/infrastructure/repositories/knowledge-element-repository_test.js

-2
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,6 @@ describe('Integration | Repository | knowledgeElementRepository', function () {
196196
});
197197
const knowledgeElementsBefore = new KnowledgeElementCollection([knowledgeElement1, knowledgeElement2]);
198198
databaseBuilder.factory.buildKnowledgeElementSnapshot({
199-
userId,
200-
snappedAt: new Date('2019-01-01'),
201199
campaignParticipationId,
202200
snapshot: knowledgeElementsBefore.toSnapshot(),
203201
});

0 commit comments

Comments
 (0)