add campaign
deploy to danak / build_and_deploy (push) Has been cancelled

This commit is contained in:
2026-07-04 09:40:28 +03:30
parent 9eebfbfb10
commit 95240a311e
5 changed files with 958 additions and 15 deletions
@@ -24,6 +24,12 @@ export class Campaign extends BaseEntity {
@Property({ default: 0 })
totalCount: number = 0;
@Property({ default: 0 })
totalCost: number = 0;
@Property({ default: 0 })
refunded: number = 0;
@Property({ default: 0 })
sentCount: number = 0;
@@ -61,6 +61,7 @@ export class CampaignDispatchListener {
reason: RestaurantCreditTransactionReason.ADJUSTMENT,
em,
});
campaign.refunded = refundAmount;
}
}
@@ -54,6 +54,8 @@ export class CampaignService {
discountCode: dto.discountCode,
status: dto.sentType === CampaignSentType.SMS ? CampaignStatus.SENDING : CampaignStatus.COMPLETED,
totalCount: 0,
totalCost: 0,
refunded: 0,
sentCount: 0,
failedCount: 0,
};
@@ -71,6 +73,7 @@ export class CampaignService {
);
campaign.totalCount = smsDispatchPlan.totalCount;
campaign.totalCost = smsDispatchPlan.totalCost;
if (smsDispatchPlan.totalCount === 0) {
campaign.status = CampaignStatus.COMPLETED;
} else {