1
0
forked from Yara724/api
This commit is contained in:
SepehrYahyaee
2026-04-28 14:27:12 +03:30
parent 9296795166
commit bbd83da2d5
13 changed files with 291 additions and 47 deletions

View File

@@ -1,31 +1,44 @@
import { Injectable } from "@nestjs/common";
import { ApiProperty } from "@nestjs/swagger";
import { IsIn, IsNotEmpty, IsNumber, IsOptional, IsString, ValidateNested } from "class-validator";
import { Type } from "class-transformer";
import { Types } from "mongoose";
class ClientName {
@ApiProperty({})
@IsString()
@IsNotEmpty()
persian: string;
@ApiProperty({})
@IsString()
@IsNotEmpty()
english: string;
}
class Property {
@ApiProperty({})
@IsString()
@IsNotEmpty()
smsApiKey: string;
}
@Injectable()
export class ClientDto {
@ApiProperty({ required: true })
@ValidateNested()
@Type(() => ClientName)
clientName: ClientName;
@ApiProperty({ required: true })
@IsNumber()
clientCode: number;
@ApiProperty({ required: false })
property: Property;
@IsOptional()
@ValidateNested()
@Type(() => Property)
property?: Property;
@ApiProperty({ examples: ["legal", "genuine"] })
@IsIn(["legal", "genuine"])
useExpertMode: "legal" | "genuine";
}
export class ClientDtoRs {
@@ -35,6 +48,9 @@ export class ClientDtoRs {
useExpertsMode: string;
constructor(readonly client) {
this.persian = client.clientName.persian;
this.english = client.clientName.english;
this.clientId = client._id;
this.useExpertsMode = client.useExpertMode;
}
}