Skip to content

[Fase 2] Repository CRUD per Companies #8

Description

@elecicalla

Context

Le aziende hanno il modello piu' complesso con relazioni a contatti, categorie, e tabelle lookup (ARR, employee range, connection strength).

Objective

Creare src/db/repositories/company-repository.ts con:

  • getAllCompanies(): Company[]
  • getCompanyById(id: string): Company | null
  • createCompany(data): Company
  • updateCompany(id, data): Company | null
  • removeCompany(id): boolean
  • Gestione delle join tables: company_contacts, company_categories
  • Risoluzione FK lookup: connectionStrengthId, estimatedArrId, employeeRangeId

Acceptance Criteria

  • 5 funzioni CRUD base + gestione relazioni M:N
  • createCompany gestisce correttamente contactIds[] e categoryIds[] (insert nelle join tables)
  • getCompanyById ricostruisce l'oggetto Company completo con array di contactIds e categoryIds
  • removeCompany pulisce le join tables (company_contacts, company_categories, deal_companies, task_companies, note_companies)
  • Badge (name+state) serializzato come due colonne separate

Dependencies

Depends on: #6

Notes

Phase: Fase 2
Ref: FR-004

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions