mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 08:20:58 +00:00
complete rule engine and booking flow
This commit is contained in:
@@ -27,7 +27,7 @@ export class PriorityRulesService {
|
||||
|
||||
const [data, total] = await this.repository.findAndCount({
|
||||
where,
|
||||
order: { priorityType: 'ASC' },
|
||||
order: { code: 'ASC' },
|
||||
skip: (page - 1) * pageSize,
|
||||
take: pageSize,
|
||||
});
|
||||
@@ -43,16 +43,15 @@ export class PriorityRulesService {
|
||||
|
||||
/** Create a new priority rule. */
|
||||
async create(dto: CreatePriorityRuleDto): Promise<PriorityRule> {
|
||||
const existing = await this.repository.findAll({ where: { priorityType: dto.priorityType } });
|
||||
const existing = await this.repository.findAll({ where: { code: dto.code } });
|
||||
if (existing.length > 0) {
|
||||
throw new ConflictException(`Priority rule for type "${dto.priorityType}" already exists`);
|
||||
throw new ConflictException(`Priority rule with code "${dto.code}" already exists`);
|
||||
}
|
||||
return this.repository.create({
|
||||
priorityType: dto.priorityType,
|
||||
ruleName: dto.ruleName,
|
||||
description: dto.description ?? null,
|
||||
activationCondition: dto.activationCondition ?? null,
|
||||
bonusPoints: dto.bonusPoints,
|
||||
code: dto.code,
|
||||
label: dto.label,
|
||||
score: dto.score,
|
||||
conditionCurrency: dto.conditionCurrency ?? null,
|
||||
isActive: dto.isActive ?? false,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user