feat(tickets): TicketResponse carries asset_id + asset_name; TicketFilter accepts asset_id (PMS-344) #258

Merged
YousifShkara merged 1 commit from feat/pms-344-server-asset-id-filter-and-name into main 2026-06-16 09:11:55 +02:00
Owner

Server-side half of PMS-344. The tickets schema already carries an asset_id column (migrations/011_assets.sql + the CreateTicketRequest / UpdateTicketRequest DTOs both bind it), but TicketResponse never surfaced it and TicketFilter could not filter by it - so the SPA had no way to render the asset on a ticket detail or list a tenant's tickets-for-this-asset.

Three additions, all read-side only (no migration, no behaviour change for existing callers):

  • TicketResponse.asset_id + asset_name. asset_name comes from a new LEFT JOIN to assets in the shared TICKET_RESPONSE_SELECT clause, so both the detail and list paths pick it up. Tickets with no asset see both fields as None.
  • TicketFilter.asset_id. The new build_ticket_filter_sql branch mirrors the company_id / assigned_to_id pattern exactly (placeholder, bind, indices advance). Drives the upcoming "Related Tickets" section on the asset detail page via GET /api/v1/tickets?asset_id=.
  • TicketResponseRow grows the matching column fields so the FromRow derive picks them up; the From for TicketResponse impl threads them through.

Companion mokosh-apps PR will read these fields and wire an AssetPicker into the ticket create/edit form plus a Related Tickets section onto the asset detail page.

#PMS-344

Server-side half of PMS-344. The tickets schema already carries an asset_id column (migrations/011_assets.sql + the CreateTicketRequest / UpdateTicketRequest DTOs both bind it), but TicketResponse never surfaced it and TicketFilter could not filter by it - so the SPA had no way to render the asset on a ticket detail or list a tenant's tickets-for-this-asset. Three additions, all read-side only (no migration, no behaviour change for existing callers): - TicketResponse.asset_id + asset_name. asset_name comes from a new LEFT JOIN to assets in the shared TICKET_RESPONSE_SELECT clause, so both the detail and list paths pick it up. Tickets with no asset see both fields as None. - TicketFilter.asset_id. The new build_ticket_filter_sql branch mirrors the company_id / assigned_to_id pattern exactly (placeholder, bind, indices advance). Drives the upcoming "Related Tickets" section on the asset detail page via GET /api/v1/tickets?asset_id=<uuid>. - TicketResponseRow grows the matching column fields so the FromRow derive picks them up; the From<TicketResponseRow> for TicketResponse impl threads them through. Companion mokosh-apps PR will read these fields and wire an AssetPicker into the ticket create/edit form plus a Related Tickets section onto the asset detail page. #PMS-344
feat(tickets): TicketResponse carries asset_id + asset_name; TicketFilter accepts asset_id (PMS-344)
All checks were successful
Create release / Create release from merged PR (pull_request) Has been skipped
E2E / Playwright against staging (pull_request) Successful in 41s
Check / fmt + clippy + compile + unit/doc tests (pull_request) Successful in 1m18s
Integration / integration tests (pull_request) Successful in 3m22s
3a35f979ce
Server-side half of PMS-344. The tickets schema already carries an asset_id column (migrations/011_assets.sql + the CreateTicketRequest / UpdateTicketRequest DTOs both bind it), but TicketResponse never surfaced it and TicketFilter could not filter by it - so the SPA had no way to render the asset on a ticket detail or list a tenant's tickets-for-this-asset.

Three additions, all read-side only (no migration, no behaviour change for existing callers):

- TicketResponse.asset_id + asset_name. asset_name comes from a new LEFT JOIN to assets in the shared TICKET_RESPONSE_SELECT clause, so both the detail and list paths pick it up. Tickets with no asset see both fields as None.
- TicketFilter.asset_id. The new build_ticket_filter_sql branch mirrors the company_id / assigned_to_id pattern exactly (placeholder, bind, indices advance). Drives the upcoming "Related Tickets" section on the asset detail page via GET /api/v1/tickets?asset_id=<uuid>.
- TicketResponseRow grows the matching column fields so the FromRow derive picks them up; the From<TicketResponseRow> for TicketResponse impl threads them through.

Companion mokosh-apps PR will read these fields and wire an AssetPicker into the ticket create/edit form plus a Related Tickets section onto the asset detail page.

#PMS-344
YousifShkara deleted branch feat/pms-344-server-asset-id-filter-and-name 2026-06-16 09:11:55 +02:00
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!258
No description provided.