From 86b0096350aa3b2153b85de375f722e18e3a0aad Mon Sep 17 00:00:00 2001 From: Emilio Date: Fri, 17 Oct 2025 14:01:41 -0600 Subject: [PATCH] se creo el service de servicio --- src/servicio/dto/servicios-responsable.dto.ts | 22 ++++++++++ src/servicio/dto/update-servicio.dto.ts | 43 +++++++++++++++++-- 2 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 src/servicio/dto/servicios-responsable.dto.ts diff --git a/src/servicio/dto/servicios-responsable.dto.ts b/src/servicio/dto/servicios-responsable.dto.ts new file mode 100644 index 0000000..48437a8 --- /dev/null +++ b/src/servicio/dto/servicios-responsable.dto.ts @@ -0,0 +1,22 @@ +import { IsNumber, IsOptional, IsString } from 'class-validator'; + +export class ServiciosResponsableDto { + @IsNumber() + idUsuario: number; + + @IsOptional() + @IsNumber() + idStatus?: number; + + @IsOptional() + @IsString() + nombre?: string; + + @IsOptional() + @IsString() + numeroCuenta?: string; + + @IsOptional() + @IsNumber() + pagina?: number; +} diff --git a/src/servicio/dto/update-servicio.dto.ts b/src/servicio/dto/update-servicio.dto.ts index c830b2d..2a4eeb1 100644 --- a/src/servicio/dto/update-servicio.dto.ts +++ b/src/servicio/dto/update-servicio.dto.ts @@ -1,4 +1,41 @@ -import { PartialType } from '@nestjs/mapped-types'; -import { CreateServicioDto } from './create-servicio.dto'; +import { + IsOptional, + IsString, + IsEmail, + IsDateString, + IsNumber, + MaxLength, +} from 'class-validator'; +import { Type } from 'class-transformer'; -export class UpdateServicioDto extends PartialType(CreateServicioDto) {} +export class UpdateServicioDto { + @IsNumber({}, { message: 'idServicio debe ser un número entero' }) + @Type(() => Number) + idServicio: number; + + @IsOptional() + @IsEmail({}, { message: 'correo debe ser un correo válido' }) + correo?: string; + + @IsOptional() + @IsDateString({}, { message: 'fechaInicio debe ser una fecha válida' }) + fechaInicio?: string; + + @IsOptional() + @IsDateString({}, { message: 'fechaFin debe ser una fecha válida' }) + fechaFin?: string; + + @IsOptional() + @IsDateString({}, { message: 'fechaNacimiento debe ser una fecha válida' }) + fechaNacimiento?: string; + + @IsOptional() + @IsString({ message: 'direccion debe ser texto' }) + @MaxLength(200, { message: 'direccion no debe exceder los 200 caracteres' }) + direccion?: string; + + @IsOptional() + @IsString({ message: 'telefono debe ser un número o texto válido' }) + @MaxLength(15, { message: 'telefono no debe exceder los 15 caracteres' }) + telefono?: string; +}