Add change-password endpoint and VIP product pricing fields.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Alireza Hassani
2026-09-08 00:51:25 +03:30
co-authored by Cursor
parent fe78a99b78
commit 3da8a5d4a2
9 changed files with 110 additions and 8 deletions
+39
View File
@@ -35,6 +35,11 @@ export class ProductVariantDto {
@IsInt()
@Min(0)
discountPrice?: number;
@IsOptional()
@IsInt()
@Min(0)
vipPrice?: number;
}
export class CreateProductDto {
@@ -98,6 +103,23 @@ export class CreateProductDto {
@IsBoolean()
published?: boolean;
@IsOptional()
@IsBoolean()
vipEnabled?: boolean;
@IsOptional()
@IsBoolean()
vipOnly?: boolean;
@IsOptional()
@IsBoolean()
vipSpecialPrice?: boolean;
@IsOptional()
@IsInt()
@Min(0)
vipPrice?: number;
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
@@ -173,6 +195,23 @@ export class UpdateProductDto {
@IsBoolean()
published?: boolean;
@IsOptional()
@IsBoolean()
vipEnabled?: boolean;
@IsOptional()
@IsBoolean()
vipOnly?: boolean;
@IsOptional()
@IsBoolean()
vipSpecialPrice?: boolean;
@IsOptional()
@IsInt()
@Min(0)
vipPrice?: number | null;
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
+14
View File
@@ -97,6 +97,10 @@ export class ProductsService {
galleryKeys: dto.galleryKeys ?? [],
tags: dto.tags ?? [],
published: dto.published ?? true,
vipEnabled: dto.vipEnabled ?? false,
vipOnly: dto.vipOnly ?? false,
vipSpecialPrice: dto.vipSpecialPrice ?? false,
vipPrice: dto.vipPrice,
variants: dto.variants?.length
? {
create: dto.variants.map((v) => ({
@@ -105,6 +109,7 @@ export class ProductsService {
packageId: v.packageId ?? '',
price: v.price,
discountPrice: v.discountPrice,
vipPrice: v.vipPrice,
})),
}
: undefined,
@@ -132,6 +137,7 @@ export class ProductsService {
packageId: v.packageId ?? '',
price: v.price,
discountPrice: v.discountPrice,
vipPrice: v.vipPrice,
})),
});
}
@@ -164,6 +170,14 @@ export class ProductsService {
: {}),
...(dto.tags !== undefined ? { tags: dto.tags } : {}),
...(dto.published !== undefined ? { published: dto.published } : {}),
...(dto.vipEnabled !== undefined
? { vipEnabled: dto.vipEnabled }
: {}),
...(dto.vipOnly !== undefined ? { vipOnly: dto.vipOnly } : {}),
...(dto.vipSpecialPrice !== undefined
? { vipSpecialPrice: dto.vipSpecialPrice }
: {}),
...(dto.vipPrice !== undefined ? { vipPrice: dto.vipPrice } : {}),
},
include: { variants: true },
});