From ad4044e286a2f3eabc2551b4572295bdbe1bf2c5 Mon Sep 17 00:00:00 2001 From: alexeh Date: Tue, 17 Oct 2023 07:34:21 +0300 Subject: [PATCH] Refactor indicator activation --- api/src/modules/indicators/indicators.service.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/api/src/modules/indicators/indicators.service.ts b/api/src/modules/indicators/indicators.service.ts index 6484e9d39..3427570b6 100644 --- a/api/src/modules/indicators/indicators.service.ts +++ b/api/src/modules/indicators/indicators.service.ts @@ -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 }, });