templete campain

This commit is contained in:
2026-07-11 22:08:41 +03:30
parent bf4e4c8d65
commit b1da7fdeac
19 changed files with 867 additions and 37 deletions
@@ -9,6 +9,7 @@ import {
UpdateDateColumn,
} from 'typeorm';
import { Salon } from '../../salons/entities/salon.entity';
import { SmsTemplate } from '../../sms-templates/entities/sms-template.entity';
import { User } from '../../users/entities/user.entity';
import { CampaignRunStatus } from '../enums/campaign-run-status.enum';
import { CampaignTrigger } from '../enums/campaign-trigger.enum';
@@ -77,6 +78,29 @@ export class CampaignRun {
@JoinColumn({ name: 'triggeredByUserId' })
triggeredByUser: User | null;
@Column({ type: 'uuid', nullable: true })
templateId: string | null;
@ManyToOne(() => SmsTemplate, { onDelete: 'SET NULL', nullable: true })
@JoinColumn({ name: 'templateId' })
template: SmsTemplate | null;
@Column({ type: 'int', nullable: true })
discountPercent: number | null;
@Column({
type: 'decimal',
precision: 14,
scale: 2,
nullable: true,
transformer: {
to: (value: number | null) => value,
from: (value: string | null) =>
value == null ? null : parseFloat(value),
},
})
discountAmount: number | null;
@CreateDateColumn()
createdAt: Date;