Skip to content

Commit b2bd187

Browse files
tech(api): make campaign repository domain transaction compliant
1 parent 0aa62e7 commit b2bd187

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

api/src/prescription/campaign/infrastructure/repositories/campaign-repository.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { knex } from '../../../../../db/knex-database-connection.js';
21
import { CAMPAIGN_FEATURES } from '../../../../shared/domain/constants.js';
32
import { DomainTransaction } from '../../../../shared/domain/DomainTransaction.js';
43
import { NotFoundError } from '../../../../shared/domain/errors.js';
@@ -21,7 +20,8 @@ const areKnowledgeElementsResettable = async function ({ id }) {
2120
};
2221

2322
const getByCode = async function (code) {
24-
const campaign = await knex('campaigns').first().where({ code });
23+
const knexConn = DomainTransaction.getConnection();
24+
const campaign = await knexConn('campaigns').first().where({ code });
2525
if (!campaign) return null;
2626
return new Campaign(campaign);
2727
};

0 commit comments

Comments
 (0)