Skip to content

Commit

Permalink
Refactor indicator activation
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeh committed Oct 17, 2023
1 parent 93674fd commit ad4044e
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions api/src/modules/indicators/indicators.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,11 @@ export class IndicatorsService extends AppBaseService<
);
this.logger.warn(`Activating found Indicators...`);
}
const activatedIndicators: Indicator[] =
indicatorsFoundByProvidedNameCodes.map(
(i: Indicator) =>
({
...i,
status: INDICATOR_STATUS.ACTIVE,
} as Indicator),
);

await this.indicatorRepository.update(
{ nameCode: In([INDICATOR_NAME_CODES.ENL, INDICATOR_NAME_CODES.FLIL]) },
{ nameCode: In(nameCodesToActivateIndicatorsBy) },
{ status: INDICATOR_STATUS.ACTIVE },
);
await this.indicatorRepository.save(activatedIndicators);
return this.indicatorRepository.find({
where: { status: INDICATOR_STATUS.ACTIVE },
});
Expand Down

0 comments on commit ad4044e

Please sign in to comment.