89 lines
3.1 KiB
TypeScript
89 lines
3.1 KiB
TypeScript
/**
|
|
* EmployeeService - Servicio para gestión de empleados
|
|
*
|
|
* CRUD de empleados con gestión de estado y asignaciones a obras.
|
|
*
|
|
* @module HR
|
|
*/
|
|
import { Repository } from 'typeorm';
|
|
import { Employee, EstadoEmpleado, Genero } from '../entities/employee.entity';
|
|
import { EmployeeFraccionamiento } from '../entities/employee-fraccionamiento.entity';
|
|
import { ServiceContext, PaginatedResult } from '../../../shared/services/base.service';
|
|
export interface CreateEmployeeDto {
|
|
codigo: string;
|
|
nombre: string;
|
|
apellidoPaterno: string;
|
|
apellidoMaterno?: string;
|
|
curp?: string;
|
|
rfc?: string;
|
|
nss?: string;
|
|
fechaNacimiento?: Date;
|
|
genero?: Genero;
|
|
email?: string;
|
|
telefono?: string;
|
|
direccion?: string;
|
|
fechaIngreso: Date;
|
|
puestoId?: string;
|
|
departamento?: string;
|
|
tipoContrato?: string;
|
|
salarioDiario?: number;
|
|
fotoUrl?: string;
|
|
}
|
|
export interface UpdateEmployeeDto {
|
|
nombre?: string;
|
|
apellidoPaterno?: string;
|
|
apellidoMaterno?: string;
|
|
curp?: string;
|
|
rfc?: string;
|
|
nss?: string;
|
|
fechaNacimiento?: Date;
|
|
genero?: Genero;
|
|
email?: string;
|
|
telefono?: string;
|
|
direccion?: string;
|
|
puestoId?: string;
|
|
departamento?: string;
|
|
tipoContrato?: string;
|
|
salarioDiario?: number;
|
|
fotoUrl?: string;
|
|
}
|
|
export interface AssignFraccionamientoDto {
|
|
fraccionamientoId: string;
|
|
fechaInicio: Date;
|
|
fechaFin?: Date;
|
|
rol?: string;
|
|
}
|
|
export interface EmployeeFilters {
|
|
estado?: EstadoEmpleado;
|
|
puestoId?: string;
|
|
departamento?: string;
|
|
fraccionamientoId?: string;
|
|
search?: string;
|
|
}
|
|
export interface EmployeeStats {
|
|
total: number;
|
|
activos: number;
|
|
inactivos: number;
|
|
bajas: number;
|
|
porDepartamento: {
|
|
departamento: string;
|
|
count: number;
|
|
}[];
|
|
}
|
|
export declare class EmployeeService {
|
|
private readonly employeeRepository;
|
|
private readonly asignacionRepository;
|
|
constructor(employeeRepository: Repository<Employee>, asignacionRepository: Repository<EmployeeFraccionamiento>);
|
|
findWithFilters(ctx: ServiceContext, filters?: EmployeeFilters, page?: number, limit?: number): Promise<PaginatedResult<Employee>>;
|
|
findById(ctx: ServiceContext, id: string): Promise<Employee | null>;
|
|
findByCodigo(ctx: ServiceContext, codigo: string): Promise<Employee | null>;
|
|
findByCurp(ctx: ServiceContext, curp: string): Promise<Employee | null>;
|
|
create(ctx: ServiceContext, dto: CreateEmployeeDto): Promise<Employee>;
|
|
update(ctx: ServiceContext, id: string, dto: UpdateEmployeeDto): Promise<Employee | null>;
|
|
changeStatus(ctx: ServiceContext, id: string, estado: EstadoEmpleado, fechaBaja?: Date): Promise<Employee | null>;
|
|
assignToFraccionamiento(ctx: ServiceContext, employeeId: string, dto: AssignFraccionamientoDto): Promise<EmployeeFraccionamiento>;
|
|
removeFromFraccionamiento(ctx: ServiceContext, employeeId: string, fraccionamientoId: string): Promise<boolean>;
|
|
getEmployeesByFraccionamiento(ctx: ServiceContext, fraccionamientoId: string): Promise<Employee[]>;
|
|
getStats(ctx: ServiceContext): Promise<EmployeeStats>;
|
|
}
|
|
//# sourceMappingURL=employee.service.d.ts.map
|