src/clients/dto/create-client.dto.ts
Properties |
|
| Optional address |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:67
|
| Optional city |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:79
|
| Optional classRef |
Type : string
|
Decorators :
@ApiPropertyOptional({example: 'single_trip'})
|
|
Defined in src/clients/dto/create-client.dto.ts:115
|
| code |
Type : string
|
Decorators :
@ApiProperty({example: 'ACME', description: '2-20 chars, A-Z 0-9 _ - only'})
|
|
Defined in src/clients/dto/create-client.dto.ts:34
|
|
Short uppercase identifier — unique within the org. Auto-uppercased by class-transformer so admins can type lowercase without surprise. |
| Optional contactEmail |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:52
|
| Optional contactName |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:46
|
| Optional contactPhone |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:61
|
| Optional country |
Type : string
|
Decorators :
@ApiPropertyOptional({example: 'Kenya'})
|
|
Defined in src/clients/dto/create-client.dto.ts:103
|
| Optional county |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:85
|
| Optional description |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:40
|
| Optional latitude |
Type : number
|
Decorators :
@ApiPropertyOptional({example: undefined, description: 'Latitude in degrees, -90 to 90'})
|
|
Defined in src/clients/dto/create-client.dto.ts:123
|
| Optional longitude |
Type : number
|
Decorators :
@ApiPropertyOptional({example: 36.817223, description: 'Longitude in degrees, -180 to 180'})
|
|
Defined in src/clients/dto/create-client.dto.ts:131
|
| name |
Type : string
|
Decorators :
@ApiProperty({example: 'Acme Corporation'})
|
|
Defined in src/clients/dto/create-client.dto.ts:20
|
| Optional region |
Type : string
|
Decorators :
@ApiPropertyOptional({example: 'Coast'})
|
|
Defined in src/clients/dto/create-client.dto.ts:109
|
| Optional state |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:91
|
| Optional suburb |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:73
|
| Optional zipCode |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/clients/dto/create-client.dto.ts:97
|
import {
IsNotEmpty,
IsString,
IsOptional,
IsNumber,
IsEmail,
Min,
Max,
Matches,
MaxLength,
} from 'class-validator';
import { Type, Transform } from 'class-transformer';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
export class CreateClientDto {
@ApiProperty({ example: 'Acme Corporation' })
@IsString()
@IsNotEmpty()
@MaxLength(120)
name: string;
/**
* Short uppercase identifier — unique within the org. Auto-uppercased
* by class-transformer so admins can type lowercase without surprise.
*/
@ApiProperty({ example: 'ACME', description: '2-20 chars, A-Z 0-9 _ - only' })
@IsString()
@IsNotEmpty()
@MaxLength(20)
@Matches(/^[A-Z0-9_-]{2,20}$/, {
message: 'code must be 2-20 uppercase letters, digits, underscore, or hyphen',
})
@Transform(({ value }) => (typeof value === 'string' ? value.trim().toUpperCase() : value))
code: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(500)
description?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(120)
contactName?: string;
@ApiPropertyOptional()
@IsOptional()
@IsEmail()
@MaxLength(120)
contactEmail?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(30)
@Matches(/^\+?[0-9 ()\-]{7,}$/, {
message: 'contactPhone must be 7+ digits, optionally with +, spaces, dashes, or parentheses',
})
contactPhone?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(300)
address?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(80)
suburb?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(80)
city?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(80)
county?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(80)
state?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
@MaxLength(20)
zipCode?: string;
@ApiPropertyOptional({ example: 'Kenya' })
@IsOptional()
@IsString()
@MaxLength(80)
country?: string;
@ApiPropertyOptional({ example: 'Coast' })
@IsOptional()
@IsString()
@MaxLength(80)
region?: string;
@ApiPropertyOptional({ example: 'single_trip' })
@IsOptional()
@IsString()
@MaxLength(40)
classRef?: string;
@ApiPropertyOptional({ example: -1.286389, description: 'Latitude in degrees, -90 to 90' })
@IsOptional()
@Type(() => Number)
@IsNumber()
@Min(-90)
@Max(90)
latitude?: number;
@ApiPropertyOptional({ example: 36.817223, description: 'Longitude in degrees, -180 to 180' })
@IsOptional()
@Type(() => Number)
@IsNumber()
@Min(-180)
@Max(180)
longitude?: number;
}