feat(contacts): populate CompanyResponse rollup fields #59
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
psa-systems/mokosh-server!59
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/crm-ops"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The CompanyResponse DTO declared account_manager_name, contact_count,
site_count, and open_ticket_count as Option<...>, but the
From impl always set them to None and no SQL ever populated
them. The mokosh-apps Companies list page reads
company.account_manager_name and company.open_ticket_count off the
response; those columns were rendering blank on every row.
Add ContactService::enrich_companies which runs ONE follow-up query
per page (regardless of page size) and zips the four rollup values
into the responses by company id. Run it from the list and detail
route handlers.
Counts:
subqueries scoped to (tenant_id, company_id).
what the UI calls 'open'.
Internal callers of list_companies / get_company that consume the
lean Company shape (update_company, create_company, validate_fk,
contact-side validators) keep working: the base service methods
still return Company; only the route-facing flow goes through
enrich_companies.