119 lines
2.4 KiB
TypeScript
119 lines
2.4 KiB
TypeScript
import {
|
|
Allow,
|
|
IsBoolean,
|
|
IsDateString,
|
|
IsEmail,
|
|
IsInt,
|
|
IsNotEmpty,
|
|
IsOptional,
|
|
IsPositive,
|
|
IsString,
|
|
IsUUID,
|
|
} from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
import { ApiProperty } from '@nestjs/swagger';
|
|
|
|
export class CreateEmployeeDto {
|
|
@ApiProperty({
|
|
example: 1,
|
|
description: 'Unique ID of an employee(primary-key, auto-incremented)',
|
|
})
|
|
@Allow()
|
|
id: number;
|
|
|
|
@ApiProperty({
|
|
example: '0e6e2e1f-b157-4c7c-ae3f-999b3e4f914d',
|
|
description: 'UUID of the user linked to that employee',
|
|
})
|
|
@IsUUID()
|
|
@IsOptional()
|
|
user_id?: string;
|
|
|
|
@ApiProperty({
|
|
example: 'Frodo',
|
|
description: 'Employee`s first name',
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
first_name: string;
|
|
|
|
@ApiProperty({
|
|
example: 'Baggins',
|
|
description: 'Employee`s last name',
|
|
})
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
last_name: string;
|
|
|
|
@ApiProperty({
|
|
example: 'i_cant_do_this_sam@targointernet.com',
|
|
description: 'Employee`s email',
|
|
})
|
|
@IsEmail()
|
|
@IsOptional()
|
|
email: string;
|
|
|
|
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
is_supervisor: boolean;
|
|
|
|
@ApiProperty({
|
|
example: '82538437464',
|
|
description: 'Employee`s phone number',
|
|
})
|
|
@IsString()
|
|
phone_number: string;
|
|
|
|
@ApiProperty({
|
|
example: '1 Bagshot Row, Hobbiton, The Shire, Middle-earth',
|
|
description: 'Employee`s residence',
|
|
required: false,
|
|
})
|
|
@IsString()
|
|
@IsOptional()
|
|
residence?: string;
|
|
|
|
@ApiProperty({
|
|
example: 7464,
|
|
description: 'external ID for the pay system',
|
|
})
|
|
@IsInt()
|
|
@IsPositive()
|
|
@Type(() => Number)
|
|
external_payroll_id: number;
|
|
|
|
@ApiProperty({
|
|
example: 335567447,
|
|
description: 'Employee`s company code',
|
|
})
|
|
@IsInt()
|
|
@IsPositive()
|
|
@Type(() => Number)
|
|
company_code: number;
|
|
|
|
@ApiProperty({
|
|
example:'technicient',
|
|
description: 'employee`s job title',
|
|
})
|
|
@IsString()
|
|
@IsOptional()
|
|
job_title: string;
|
|
|
|
@ApiProperty({
|
|
example: '23/09/3018',
|
|
description: 'Employee`s first working day',
|
|
})
|
|
@IsDateString()
|
|
first_work_day: string;
|
|
|
|
@ApiProperty({
|
|
example: '25/03/3019',
|
|
description: 'Employee`s last working day',
|
|
required: false,
|
|
})
|
|
@IsDateString()
|
|
@IsOptional()
|
|
last_work_day?: string;
|
|
}
|