erp-construccion-backend/dist/modules/construction/services/lote.service.d.ts

86 lines
2.3 KiB
TypeScript

/**
* LoteService - Gestión de lotes/terrenos
*
* CRUD de lotes con soporte multi-tenant.
*
* @module Construction
*/
import { Repository } from 'typeorm';
import { Lote } from '../entities/lote.entity';
export interface CreateLoteDto {
manzanaId: string;
prototipoId?: string;
code: string;
officialNumber?: string;
areaM2?: number;
frontM?: number;
depthM?: number;
status?: string;
priceBase?: number;
priceFinal?: number;
}
export interface UpdateLoteDto extends Partial<CreateLoteDto> {
buyerId?: string;
saleDate?: Date;
deliveryDate?: Date;
}
export interface LoteListOptions {
tenantId: string;
manzanaId?: string;
prototipoId?: string;
page?: number;
limit?: number;
search?: string;
status?: string;
}
export declare class LoteService {
private readonly repository;
constructor(repository: Repository<Lote>);
/**
* Listar lotes
*/
findAll(options: LoteListOptions): Promise<{
items: Lote[];
total: number;
}>;
/**
* Obtener lote por ID
*/
findById(id: string, tenantId: string): Promise<Lote | null>;
/**
* Obtener lote por código dentro de una manzana
*/
findByCode(code: string, manzanaId: string, tenantId: string): Promise<Lote | null>;
/**
* Crear lote
*/
create(tenantId: string, dto: CreateLoteDto, createdBy?: string): Promise<Lote>;
/**
* Actualizar lote
*/
update(id: string, tenantId: string, dto: UpdateLoteDto, updatedBy?: string): Promise<Lote>;
/**
* Eliminar lote (soft delete)
*/
delete(id: string, tenantId: string, _deletedBy?: string): Promise<void>;
/**
* Obtener lotes por manzana
*/
findByManzana(manzanaId: string, tenantId: string): Promise<Lote[]>;
/**
* Asignar prototipo a lote
*/
assignPrototipo(id: string, tenantId: string, prototipoId: string, updatedBy?: string): Promise<Lote>;
/**
* Cambiar estado del lote
*/
changeStatus(id: string, tenantId: string, status: string, updatedBy?: string): Promise<Lote>;
/**
* Obtener estadísticas de lotes por estado
*/
getStatsByStatus(tenantId: string, manzanaId?: string): Promise<{
status: string;
count: number;
}[]>;
}
//# sourceMappingURL=lote.service.d.ts.map