count character
This commit is contained in:
@@ -9,6 +9,7 @@ import { CampaignTargetingService } from './campaign-targeting.service';
|
||||
import { CampaignsService } from './campaigns.service';
|
||||
import { CampaignTrigger } from './enums/campaign-trigger.enum';
|
||||
import { CampaignType } from './enums/campaign-type.enum';
|
||||
import { getCampaignTypeDefinition } from './constants/campaign-types.constants';
|
||||
|
||||
@Injectable()
|
||||
export class CampaignAutomationService {
|
||||
@@ -114,7 +115,13 @@ export class CampaignAutomationService {
|
||||
}
|
||||
|
||||
try {
|
||||
await this.salonSubscriptionsService.consumeSms(salonId, targets.length);
|
||||
const definition = getCampaignTypeDefinition(type);
|
||||
const smsParts = await this.campaignsService.calculateCampaignSmsParts(
|
||||
definition.scenarioKey,
|
||||
salon,
|
||||
targets,
|
||||
);
|
||||
await this.salonSubscriptionsService.consumeSms(salonId, smsParts);
|
||||
} catch (error) {
|
||||
this.logger.warn(
|
||||
`Skipping ${type} campaign for salon ${salonId}: ${(error as Error).message}`,
|
||||
|
||||
Reference in New Issue
Block a user