chore: create customer

This commit is contained in:
Matin
2025-02-18 12:20:08 +03:30
parent cad8e15941
commit 38dc9d8e0f
4 changed files with 146 additions and 5 deletions
+44 -4
View File
@@ -1,10 +1,10 @@
import { ApiProperty, PartialType } from "@nestjs/swagger";
import { IsEmail, IsMobilePhone, IsNotEmpty, IsNumberString, IsString, Length, MinLength } from "class-validator";
import { ApiProperty, ApiPropertyOptional, PartialType } from "@nestjs/swagger";
import { IsEmail, IsMobilePhone, IsNotEmpty, IsNumberString, IsOptional, IsString, Length, MinLength } from "class-validator";
import { CreateLegalUserDto } from "./create-legal-user.dto";
import { AuthMessage } from "../../../common/enums/message.enum";
import { AuthMessage, FinancialMessage } from "../../../common/enums/message.enum";
export class CreateUserDto extends PartialType(CreateLegalUserDto) {
export class CreateCustomerDto extends PartialType(CreateLegalUserDto) {
@IsNotEmpty({ message: AuthMessage.PHONE_NOT_EMPTY })
@IsMobilePhone("fa-IR", {}, { message: AuthMessage.INVALID_PHONE_FORMAT })
@Length(11, 11, { message: AuthMessage.PHONE_SHOULD_BE_11_DIGIT })
@@ -44,4 +44,44 @@ export class CreateUserDto extends PartialType(CreateLegalUserDto) {
@ApiProperty({ description: "password", example: "12S345SS678" })
@MinLength(8, { message: AuthMessage.PASSWORD_LENGTH })
password: string;
@ApiPropertyOptional({ description: "Economic code" })
@IsOptional()
@IsString({ message: FinancialMessage.ECONOMIC_CODE_INVALID })
economicCode?: string;
@ApiPropertyOptional({ description: "Company registered name" })
@IsOptional()
@IsString({ message: FinancialMessage.ECONOMIC_CODE_INVALID })
companyRegisteredName?: string;
@ApiPropertyOptional({ description: "Registration ID" })
@IsOptional()
@IsString({ message: FinancialMessage.REGISTRATION_ID_INVALID })
registrationId?: string;
@ApiPropertyOptional({ description: "national Id" })
@IsOptional()
@IsString({ message: FinancialMessage.NATIONAL_ID_INVALID })
nationalId?: string;
@ApiPropertyOptional({ description: "number" })
@IsOptional()
@IsString({ message: FinancialMessage.FIXED_PHONE_INVALID })
number?: string;
@ApiPropertyOptional({ description: "postalCode" })
@IsOptional()
@IsString({ message: FinancialMessage.NATIONAL_ID_INVALID })
postalCode?: string;
@ApiPropertyOptional({ description: "address" })
@IsOptional()
@IsString({ message: FinancialMessage.NATIONAL_ID_INVALID })
address?: string;
@ApiPropertyOptional({ description: "City id", example: "1" })
@IsOptional()
@IsNotEmpty({ message: FinancialMessage.CITY_ID_REQUIRED })
cityId: string;
}