workspace-v1/projects/erp-construccion/docs/02-definicion-modulos/MAI-018-preconstruccion-licitaciones/especificaciones/ET-PRE-005-gestión de proveedores.md
rckrdmrd 66161b1566 feat: Workspace-v1 complete migration with NEXUS v3.4
Sistema NEXUS v3.4 migrado con:

Estructura principal:
- core/orchestration: Sistema SIMCO + CAPVED (27 directivas, 28 perfiles)
- core/catalog: Catalogo de funcionalidades reutilizables
- shared/knowledge-base: Base de conocimiento compartida
- devtools/scripts: Herramientas de desarrollo
- control-plane/registries: Control de servicios y CI/CD
- orchestration/: Configuracion de orquestacion de agentes

Proyectos incluidos (11):
- gamilit (submodule -> GitHub)
- trading-platform (OrbiquanTIA)
- erp-suite con 5 verticales:
  - erp-core, construccion, vidrio-templado
  - mecanicas-diesel, retail, clinicas
- betting-analytics
- inmobiliaria-analytics
- platform_marketing_content
- pos-micro, erp-basico

Configuracion:
- .gitignore completo para Node.js/Python/Docker
- gamilit como submodule (git@github.com:rckrdmrd/gamilit-workspace.git)
- Sistema de puertos estandarizado (3005-3199)

Generated with NEXUS v3.4 Migration System
EPIC-010: Configuracion Git y Repositorios
2026-01-04 03:37:42 -06:00

1.2 KiB

ET-PRE-005: Gestión de Proveedores

ID: ET-PRE-005 | Módulo: MAI-018

Vendor Service

@Injectable()
export class VendorService {
  async register(dto: CreateVendorDto): Promise<Vendor> {
    await this.validateRFC(dto.rfc);
    const vendor = await this.vendorRepo.save(dto);
    await this.requestDocumentation(vendor.id);
    return vendor;
  }

  async updateDocumentation(vendorId: string, docs: VendorDocuments): Promise<void> {
    const allValid = this.validateDocuments(docs);
    await this.vendorRepo.update(vendorId, { documentacionVigente: allValid });
  }

  async updateRating(vendorId: string, contractId: string, rating: number): Promise<void> {
    const vendor = await this.findOne(vendorId);
    const history = await this.getContractHistory(vendorId);
    const newRating = this.calculateWeightedRating(history, rating);
    await this.vendorRepo.update(vendorId, { rating: newRating });
  }

  @Cron('0 8 * * 1') // Every Monday
  async checkDocumentExpiration(): Promise<void> {
    const vendors = await this.vendorRepo.findExpiringDocs(30);
    for (const vendor of vendors) {
      await this.notificationService.send(vendor.contactEmail, 'document_expiring');
    }
  }
}

Generado: 2025-11-20