erp-construccion-backend/dist/modules/budgets/services/concepto.service.d.ts

60 lines
1.9 KiB
TypeScript

/**
* ConceptoService - Catalogo de Conceptos de Obra
*
* Gestiona el catálogo jerárquico de conceptos de obra.
* Los conceptos pueden tener estructura padre-hijo (niveles).
*
* @module Budgets
*/
import { Repository } from 'typeorm';
import { BaseService, ServiceContext, PaginatedResult } from '../../../shared/services/base.service';
import { Concepto } from '../entities/concepto.entity';
export interface CreateConceptoDto {
code: string;
name: string;
description?: string;
parentId?: string;
unitId?: string;
unitPrice?: number;
isComposite?: boolean;
}
export interface UpdateConceptoDto {
name?: string;
description?: string;
unitId?: string;
unitPrice?: number;
isComposite?: boolean;
}
export declare class ConceptoService extends BaseService<Concepto> {
constructor(repository: Repository<Concepto>);
/**
* Crear un nuevo concepto con cálculo automático de nivel y path
*/
createConcepto(ctx: ServiceContext, data: CreateConceptoDto): Promise<Concepto>;
/**
* Obtener conceptos raíz (sin padre)
*/
findRootConceptos(ctx: ServiceContext, page?: number, limit?: number): Promise<PaginatedResult<Concepto>>;
/**
* Obtener hijos de un concepto
*/
findChildren(ctx: ServiceContext, parentId: string): Promise<Concepto[]>;
/**
* Obtener árbol completo de conceptos
*/
getConceptoTree(ctx: ServiceContext, rootId?: string): Promise<ConceptoNode[]>;
private buildTree;
/**
* Buscar conceptos por código o nombre
*/
search(ctx: ServiceContext, term: string, limit?: number): Promise<Concepto[]>;
/**
* Verificar si un código ya existe
*/
codeExists(ctx: ServiceContext, code: string): Promise<boolean>;
}
interface ConceptoNode extends Concepto {
children: ConceptoNode[];
}
export {};
//# sourceMappingURL=concepto.service.d.ts.map