fix(assets): surface company_name on AssetResponse via LEFT JOIN #275
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/pms-336-asset-company-name"
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?
AssetResponse carried company_id but no company_name, so the Assets list Company column was blank for every asset (an asset always has a company_id, so the gap was universal). This mirrors the already-correct tickets module and the sibling gaps filed for contacts (PMS-334) and projects (PMS-335).
Add company_name: Option to AssetResponse and resolve it with a LEFT JOIN on companies (co.id = a.company_id AND co.tenant_id = a.tenant_id) in both the list and get queries, exactly as TicketResponse does. The assets table is aliased
aand every list WHERE condition is qualified witha.so columns stay unambiguous across the join; the COUNT query reuses the same aliased clause. AssetRow and its From impl carry the new field through.Extend the assets integration test to assert company_name is populated on both the detail (GET /assets/{id}) and the filtered list rows.
#PMS-336
AssetResponse carried company_id but no company_name, so the Assets list Company column was blank for every asset (an asset always has a company_id, so the gap was universal). This mirrors the already-correct tickets module and the sibling gaps filed for contacts (PMS-334) and projects (PMS-335). Add company_name: Option<String> to AssetResponse and resolve it with a LEFT JOIN on companies (co.id = a.company_id AND co.tenant_id = a.tenant_id) in both the list and get queries, exactly as TicketResponse does. The assets table is aliased `a` and every list WHERE condition is qualified with `a.` so columns stay unambiguous across the join; the COUNT query reuses the same aliased clause. AssetRow and its From impl carry the new field through. Extend the assets integration test to assert company_name is populated on both the detail (GET /assets/{id}) and the filtered list rows. #PMS-336