Add TypeORM entity and DTOs for Projects timesheets feature: - TimesheetEntity with all fields matching DDL schema - Extended DTOs for bulk operations (submit, approve, reject) - Summary types for reporting (by project, user, task) - Updated module exports to include new files Complements existing timesheets.service.ts implementation. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
84 lines
1.9 KiB
TypeScript
84 lines
1.9 KiB
TypeScript
// Note: Basic CreateTimesheetDto, UpdateTimesheetDto, TimesheetFilters are defined in timesheets.service.ts
|
|
// This file contains extended DTOs for additional functionality
|
|
|
|
/**
|
|
* Respuesta de timesheet con datos relacionados
|
|
*/
|
|
export interface TimesheetResponse {
|
|
id: string;
|
|
tenant_id: string;
|
|
company_id: string;
|
|
project_id: string;
|
|
project_name?: string;
|
|
task_id: string | null;
|
|
task_name?: string;
|
|
user_id: string;
|
|
user_name?: string;
|
|
date: Date;
|
|
hours: number;
|
|
description: string | null;
|
|
billable: boolean;
|
|
invoiced: boolean;
|
|
invoice_id: string | null;
|
|
status: 'draft' | 'submitted' | 'approved' | 'rejected';
|
|
approved_by: string | null;
|
|
approved_at: Date | null;
|
|
created_at: Date;
|
|
created_by: string | null;
|
|
updated_at: Date | null;
|
|
}
|
|
|
|
/**
|
|
* Resumen de horas por proyecto
|
|
*/
|
|
export interface TimesheetSummaryByProject {
|
|
project_id: string;
|
|
project_name: string;
|
|
total_hours: number;
|
|
billable_hours: number;
|
|
non_billable_hours: number;
|
|
invoiced_hours: number;
|
|
pending_hours: number;
|
|
}
|
|
|
|
/**
|
|
* Resumen de horas por usuario
|
|
*/
|
|
export interface TimesheetSummaryByUser {
|
|
user_id: string;
|
|
user_name: string;
|
|
total_hours: number;
|
|
billable_hours: number;
|
|
approved_hours: number;
|
|
pending_approval: number;
|
|
}
|
|
|
|
/**
|
|
* Resumen de horas por tarea
|
|
*/
|
|
export interface TimesheetSummaryByTask {
|
|
task_id: string;
|
|
task_name: string;
|
|
project_id: string;
|
|
project_name: string;
|
|
estimated_hours: number;
|
|
spent_hours: number;
|
|
remaining_hours: number;
|
|
progress_percentage: number;
|
|
}
|
|
|
|
/**
|
|
* Resumen general de timesheets
|
|
*/
|
|
export interface TimesheetSummary {
|
|
total_hours: number;
|
|
billable_hours: number;
|
|
non_billable_hours: number;
|
|
invoiced_hours: number;
|
|
approved_hours: number;
|
|
pending_approval_hours: number;
|
|
by_project?: TimesheetSummaryByProject[];
|
|
by_user?: TimesheetSummaryByUser[];
|
|
by_task?: TimesheetSummaryByTask[];
|
|
}
|