feat(admin): implement 4 admin modules schema, migrations, DTOs and controllers with CSV export
This commit is contained in:
1 parent
5e0541c739
commit
ff3f819fb6
12 files changed
+1584
-157
No files matched your search
@@ -0,0 +1,116 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsString,
|
||||
IsOptional,
|
||||
IsArray,
|
||||
} from "class-validator";
|
||||
import { PaginationDto } from "../../common/dto/pagination.dto";
|
||||
|
||||
export class CreateB2BLeadDto {
|
||||
@ApiProperty({ description: "نام کلینیک یا سازمان", example: "کلینیک دامپزشکی مهر" })
|
||||
@IsString()
|
||||
clinicName!: string;
|
||||
|
||||
@ApiProperty({ description: "نام شخص رابط", example: "دکتر حسینی" })
|
||||
@IsString()
|
||||
contactPerson!: string;
|
||||
|
||||
@ApiProperty({ description: "شماره تلفن تماس", example: "09123456789" })
|
||||
@IsString()
|
||||
phone!: string;
|
||||
|
||||
@ApiProperty({ description: "شهر", example: "تهران" })
|
||||
@IsString()
|
||||
city!: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "منطقه شهرداری یا محله", example: "منطقه ۲" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
district?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "سطح یا تییر همکاری", example: "STANDARD", default: "STANDARD" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
tier?: string = "STANDARD";
|
||||
|
||||
@ApiPropertyOptional({ description: "تخصصها", example: ["surgery", "internal"] })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
specialties?: string[] = [];
|
||||
|
||||
@ApiPropertyOptional({ description: "وضعیت لید", example: "NEW", default: "NEW" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
status?: string = "NEW";
|
||||
|
||||
@ApiPropertyOptional({ description: "یادداشتها و توضیحات" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export class UpdateB2BLeadDto {
|
||||
@ApiPropertyOptional({ description: "نام کلینیک" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
clinicName?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "نام شخص رابط" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
contactPerson?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "شماره تماس" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
phone?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "شهر" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
city?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "منطقه" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
district?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "سطح همکاری" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
tier?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "تخصصها" })
|
||||
@IsOptional()
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
specialties?: string[];
|
||||
|
||||
@ApiPropertyOptional({ description: "وضعیت لید" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
status?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "یادداشتها" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
export class QueryB2BLeadDto extends PaginationDto {
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس شهر" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
city?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس سطح همکاری (tier)" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
tier?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس وضعیت" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
status?: string;
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsString,
|
||||
IsNumber,
|
||||
IsBoolean,
|
||||
IsOptional,
|
||||
IsUUID,
|
||||
Min,
|
||||
} from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
import { PaginationDto } from "../../common/dto/pagination.dto";
|
||||
|
||||
export class CreateCompetitorPriceDto {
|
||||
@ApiProperty({ description: "شناسه محصول", example: "123e4567-e89b-12d3-a456-426614174000" })
|
||||
@IsUUID()
|
||||
productId!: string;
|
||||
|
||||
@ApiProperty({ description: "نام رقیب / فروشگاه", example: "دیجیکالا" })
|
||||
@IsString()
|
||||
competitorName!: string;
|
||||
|
||||
@ApiProperty({ description: "قیمت رقیب به تومان", example: 450000 })
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
competitorPrice!: number;
|
||||
|
||||
@ApiProperty({ description: "آدرس لینک صفحه محصول در سایت رقیب", example: "https://competitor.com/p/123" })
|
||||
@IsString()
|
||||
shopUrl!: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "آیا در سایت رقیب موجود است؟", default: true })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
inStock?: boolean = true;
|
||||
}
|
||||
|
||||
export class UpdateCompetitorPriceDto {
|
||||
@ApiPropertyOptional({ description: "شناسه محصول" })
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
productId?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "نام رقیب" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
competitorName?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "قیمت رقیب" })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
competitorPrice?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: "آدرس لینک رقیب" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
shopUrl?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "وضعیت موجودی در سایت رقیب" })
|
||||
@IsOptional()
|
||||
@IsBoolean()
|
||||
inStock?: boolean;
|
||||
}
|
||||
|
||||
export class QueryCompetitorPriceDto extends PaginationDto {
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس شناسه محصول" })
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
productId?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس نام رقیب" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
competitorName?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس وضعیت موجودی" })
|
||||
@IsOptional()
|
||||
@Type(() => Boolean)
|
||||
@IsBoolean()
|
||||
inStock?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsString,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsUUID,
|
||||
IsIn,
|
||||
Min,
|
||||
} from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
import { PaginationDto } from "../../common/dto/pagination.dto";
|
||||
|
||||
export class CreatePriceSuggestionDto {
|
||||
@ApiProperty({ description: "شناسه محصول", example: "123e4567-e89b-12d3-a456-426614174000" })
|
||||
@IsUUID()
|
||||
productId!: string;
|
||||
|
||||
@ApiProperty({ description: "قیمت پیشنهادی", example: 420000 })
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
suggestedPrice!: number;
|
||||
|
||||
@ApiProperty({ description: "قیمت فعلی", example: 450000 })
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
currentPrice!: number;
|
||||
|
||||
@ApiPropertyOptional({ description: "قیمت مبنای رقیب", example: 410000 })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
competitorBenchmark?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: "دلیل و تحلیل پیشنهاد قیمت" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
rationale?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "وضعیت پیشنهاد", enum: ["pending", "approved", "rejected"], default: "pending" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(["pending", "approved", "rejected"])
|
||||
status?: string = "pending";
|
||||
}
|
||||
|
||||
export class UpdatePriceSuggestionDto {
|
||||
@ApiPropertyOptional({ description: "قیمت پیشنهادی" })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
suggestedPrice?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: "قیمت فعلی" })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
currentPrice?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: "قیمت مبنای رقیب" })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
competitorBenchmark?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: "دلیل پیشنهاد" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
rationale?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "وضعیت پیشنهاد", enum: ["pending", "approved", "rejected"] })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(["pending", "approved", "rejected"])
|
||||
status?: string;
|
||||
}
|
||||
|
||||
export class QueryPriceSuggestionDto extends PaginationDto {
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس شناسه کالا" })
|
||||
@IsOptional()
|
||||
@IsUUID()
|
||||
productId?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس وضعیت", enum: ["pending", "approved", "rejected"] })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(["pending", "approved", "rejected"])
|
||||
status?: string;
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
|
||||
import {
|
||||
IsString,
|
||||
IsNumber,
|
||||
IsOptional,
|
||||
IsIn,
|
||||
Min,
|
||||
} from "class-validator";
|
||||
import { Type } from "class-transformer";
|
||||
import { PaginationDto } from "../../common/dto/pagination.dto";
|
||||
|
||||
export class CreateSmsCampaignDto {
|
||||
@ApiProperty({ description: "عنوان کمپین", example: "تخفیف پایان فصل مکملها" })
|
||||
@IsString()
|
||||
title!: string;
|
||||
|
||||
@ApiProperty({ description: "متن پیامک", example: "تخفیف ویژه ۲۰ درصدی مکملهای کانینا به مدت ۳ روز! کد: OFF20" })
|
||||
@IsString()
|
||||
body!: string;
|
||||
|
||||
@ApiProperty({ description: "سگمنت مخاطبان", example: "b2b_clinics" })
|
||||
@IsString()
|
||||
targetSegment!: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "هزینه تخمینی کمپین به تومان", example: 2500000 })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
estimatedCost?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: "وضعیت کمپین", enum: ["draft", "approved", "rejected", "sent"], default: "draft" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(["draft", "approved", "rejected", "sent"])
|
||||
status?: string = "draft";
|
||||
|
||||
@ApiPropertyOptional({ description: "متریکها و نتایج ارسال کمپین" })
|
||||
@IsOptional()
|
||||
metrics?: Record<string, any>;
|
||||
}
|
||||
|
||||
export class UpdateSmsCampaignDto {
|
||||
@ApiPropertyOptional({ description: "عنوان کمپین" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
title?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "متن پیامک" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
body?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "سگمنت مخاطبان" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
targetSegment?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "هزینه تخمینی کمپین" })
|
||||
@IsOptional()
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
estimatedCost?: number;
|
||||
|
||||
@ApiPropertyOptional({ description: "وضعیت کمپین", enum: ["draft", "approved", "rejected", "sent"] })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(["draft", "approved", "rejected", "sent"])
|
||||
status?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "متریکها" })
|
||||
@IsOptional()
|
||||
metrics?: Record<string, any>;
|
||||
}
|
||||
|
||||
export class QuerySmsCampaignDto extends PaginationDto {
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس سگمنت مخاطبان" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
targetSegment?: string;
|
||||
|
||||
@ApiPropertyOptional({ description: "فیلتر بر اساس وضعیت کمپین", enum: ["draft", "approved", "rejected", "sent"] })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
@IsIn(["draft", "approved", "rejected", "sent"])
|
||||
status?: string;
|
||||
}
|
||||
Reference in new issue
Block a user