This commit is contained in:
2026-08-28 17:31:02 +02:00
commit 2b30e8bd39
694 changed files with 49243 additions and 0 deletions
@@ -0,0 +1,56 @@
import { IsArray, IsBoolean, IsEnum, IsNotEmpty, IsNumber, IsString, IsUUID, MaxLength, Min } from 'class-validator';
import { getAppConfig } from '../../../config';
import { NullOrDate, NullOrInt, NullOrNumber } from '../../../validation/decorators/nullOr';
import { DiscountType } from '../types/DiscountType';
const {
validation: { discountCodeMaxLength }
} = getAppConfig();
export class CreateOrUpdateDiscountCodeDto {
@IsNotEmpty()
@IsString()
@MaxLength(discountCodeMaxLength)
code: string;
@IsNotEmpty()
@IsEnum(DiscountType)
type: DiscountType;
@IsNotEmpty()
@IsNumber()
@Min(0)
value: number;
@IsNotEmpty()
@IsBoolean()
isActive: boolean;
@NullOrDate()
validFrom: Date | null;
@NullOrDate()
validUntil: Date | null;
@NullOrInt({ min: 1 })
maxRedemptions: number | null;
@NullOrNumber({ min: 0 })
minOrderAmount: number | null;
@IsNotEmpty()
@IsBoolean()
isExclusive: boolean;
@IsArray()
@IsUUID('4', { each: true })
productIds: string[];
@IsArray()
@IsUUID('4', { each: true })
categoryIds: string[];
@IsArray()
@IsUUID('4', { each: true })
variantIds: string[];
}