- Prefijo v2: MCH - TRACEABILITY-MASTER.yml creado - Listo para integracion como submodulo Workspace: v2.0.0 | SIMCO: v4.0.0
35 lines
1.7 KiB
TypeScript
35 lines
1.7 KiB
TypeScript
import { Repository } from 'typeorm';
|
|
import { Customer } from './entities/customer.entity';
|
|
import { Fiado } from './entities/fiado.entity';
|
|
import { FiadoPayment } from './entities/fiado-payment.entity';
|
|
import { CreateCustomerDto, UpdateCustomerDto, CreateFiadoDto, PayFiadoDto } from './dto/customer.dto';
|
|
export declare class CustomersService {
|
|
private readonly customerRepo;
|
|
private readonly fiadoRepo;
|
|
private readonly fiadoPaymentRepo;
|
|
constructor(customerRepo: Repository<Customer>, fiadoRepo: Repository<Fiado>, fiadoPaymentRepo: Repository<FiadoPayment>);
|
|
findAll(tenantId: string): Promise<Customer[]>;
|
|
findOne(tenantId: string, id: string): Promise<Customer>;
|
|
findByPhone(tenantId: string, phone: string): Promise<Customer | null>;
|
|
create(tenantId: string, dto: CreateCustomerDto): Promise<Customer>;
|
|
update(tenantId: string, id: string, dto: UpdateCustomerDto): Promise<Customer>;
|
|
toggleActive(tenantId: string, id: string): Promise<Customer>;
|
|
getWithFiados(tenantId: string): Promise<Customer[]>;
|
|
createFiado(tenantId: string, dto: CreateFiadoDto): Promise<Fiado>;
|
|
getFiados(tenantId: string, customerId?: string): Promise<Fiado[]>;
|
|
getPendingFiados(tenantId: string): Promise<Fiado[]>;
|
|
payFiado(tenantId: string, fiadoId: string, dto: PayFiadoDto, userId?: string): Promise<Fiado>;
|
|
cancelFiado(tenantId: string, fiadoId: string): Promise<Fiado>;
|
|
getCustomerStats(tenantId: string, customerId: string): Promise<{
|
|
customer: Customer;
|
|
stats: {
|
|
totalPurchases: number;
|
|
purchaseCount: number;
|
|
fiadoBalance: number;
|
|
fiadoLimit: number;
|
|
fiadoAvailable: number;
|
|
pendingFiados: number;
|
|
};
|
|
}>;
|
|
}
|