34 lines
1.6 KiB
TypeScript
34 lines
1.6 KiB
TypeScript
import { ApiProperty } from "@nestjs/swagger";
|
|
import { IsBoolean, IsInt, IsNotEmpty, IsString, IsUUID, Length, Min } from "class-validator";
|
|
|
|
import { SubscriptionMessage } from "../../../common/enums/message.enum";
|
|
|
|
export class CreateSubscriptionPlanDto {
|
|
@IsNotEmpty({ message: SubscriptionMessage.NAME_REQUIRED })
|
|
@IsString({ message: SubscriptionMessage.NAME_SHOULD_BE_STRING })
|
|
@Length(3, 100, { message: SubscriptionMessage.NAME_LENGTH })
|
|
@ApiProperty({ description: "the name of the subscription plan", example: "یک ماهه" })
|
|
name: string;
|
|
|
|
@IsNotEmpty({ message: SubscriptionMessage.DURATION_REQUIRED })
|
|
@IsInt({ message: SubscriptionMessage.DURATION_SHOULD_BE_INT })
|
|
@ApiProperty({ description: "the duration of the subscription plan in days", example: 30 })
|
|
duration: number;
|
|
|
|
@IsNotEmpty({ message: SubscriptionMessage.PRICE_REQUIRED })
|
|
@IsInt({ message: SubscriptionMessage.PRICE_SHOULD_BE_INT })
|
|
@Min(100_000, { message: SubscriptionMessage.PRICE_SHOULD_BE_GREATER_THAN_100_000 })
|
|
@ApiProperty({ description: "the price of the subscription plan", example: 10_000_000 })
|
|
price: number;
|
|
|
|
@IsNotEmpty({ message: SubscriptionMessage.IS_ACTIVE_REQUIRED })
|
|
@IsBoolean({ message: SubscriptionMessage.IS_ACTIVE_SHOULD_BE_BOOLEAN })
|
|
@ApiProperty({ description: "the status of the subscription plan", example: true })
|
|
isActive: boolean;
|
|
|
|
@IsNotEmpty({ message: SubscriptionMessage.SERVICE_REQUIRED })
|
|
@IsUUID("4", { message: SubscriptionMessage.SERVICE_MUST_BE_UUID })
|
|
@ApiProperty({ description: "Service ID", example: "d290f1ee-6c54-4b01-90e6-d701748f0851" })
|
|
serviceId: string;
|
|
}
|