Skip to content

[Fase 2] Repository CRUD per Contacts #7

Description

@elecicalla

Context

I contatti sono l'entita' piu' usata nel CRM. Serve un repository dedicato che esponga le operazioni CRUD conformi all'interfaccia Contact.

Objective

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

  • getAllContacts(): Contact[]
  • getContactById(id: string): Contact | null
  • createContact(data): Contact (genera UUID, setta createdAt/updatedAt)
  • updateContact(id, data): Contact | null (aggiorna updatedAt)
  • removeContact(id): boolean (elimina record + righe nelle join tables)
  • getContactsByCompany(companyId): Contact[]

Acceptance Criteria

  • Tutte le 6 funzioni esistono e compilano senza errori
  • createContact genera un UUID e setta i timestamp
  • getContactById ritorna un oggetto conforme a Contact (incluso parsing date e socialLinks JSON)
  • removeContact elimina anche le righe in company_contacts, deal_contacts, task_contacts, note_contacts
  • Tutti i parametri sono passati via prepared statements

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