fix(assets): surface company_name on AssetResponse via LEFT JOIN #275

Merged
vas2000-work merged 1 commit from fix/pms-336-asset-company-name into main 2026-06-16 23:49:34 +02:00
Owner

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 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

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
fix(assets): surface company_name on AssetResponse via LEFT JOIN
All checks were successful
E2E / Playwright against staging (pull_request) Successful in 1m8s
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 2m27s
Integration / integration tests (pull_request) Successful in 6m15s
Create release / Create release from merged PR (pull_request) Has been skipped
a3c9bb3f0e
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
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/mokosh-server!275
No description provided.