forked from Yara724/api
Initial commit after migration to gitea
This commit is contained in:
34
src/client/dto/create-branch.dto.ts
Normal file
34
src/client/dto/create-branch.dto.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { IsString, IsNotEmpty, IsOptional } from "class-validator";
|
||||
|
||||
export class CreateBranchDto {
|
||||
@ApiProperty({ example: "شهرک غرب" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
name: string;
|
||||
|
||||
@ApiProperty({ example: "1234" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
code: string;
|
||||
|
||||
@ApiProperty({ example: "استان" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
city: string;
|
||||
|
||||
@ApiProperty({ example: "شهر" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
state: string;
|
||||
|
||||
@ApiProperty({ example: "فلان آدرس" })
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
address: string;
|
||||
|
||||
@ApiProperty({ required: false, example: "0912345678" })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
phoneNumber?: string;
|
||||
}
|
||||
48
src/client/dto/create-client.dto.ts
Normal file
48
src/client/dto/create-client.dto.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { Injectable } from "@nestjs/common";
|
||||
import { ApiProperty } from "@nestjs/swagger";
|
||||
import { Types } from "mongoose";
|
||||
|
||||
class ClientName {
|
||||
@ApiProperty({})
|
||||
persian: string;
|
||||
|
||||
@ApiProperty({})
|
||||
english: string;
|
||||
}
|
||||
class Property {
|
||||
@ApiProperty({})
|
||||
smsApiKey: string;
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class ClientDto {
|
||||
@ApiProperty({ required: true })
|
||||
clientName: ClientName;
|
||||
|
||||
@ApiProperty({ required: true })
|
||||
clientCode: number;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
property: Property;
|
||||
|
||||
@ApiProperty({ examples: ["legal", "genuine"] })
|
||||
useExpertMode: "legal" | "genuine";
|
||||
}
|
||||
export class ClientDtoRs {
|
||||
persian: string;
|
||||
english: string;
|
||||
clientId: Types.ObjectId;
|
||||
useExpertsMode: string;
|
||||
constructor(readonly client) {
|
||||
this.persian = client.clientName.persian;
|
||||
}
|
||||
}
|
||||
|
||||
export class ClientLists {
|
||||
name: string;
|
||||
id: Types.ObjectId;
|
||||
constructor(client: ClientDto) {
|
||||
this.name = client.clientName.persian;
|
||||
this.id = client["_id"];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user