feat: cross-linking between all entity types #31
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_biz#31
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Context
Ref: lhumina_code/home#210
Currently each entity type is a disconnected database. The app must feel like one connected system. Every detail page should surface its related records as clickable links.
Required cross-links per entity
Company detail page
Contact detail page (
/persons)Interaction detail page (
/contacts)Deal detail page
Contract detail page
Finance detail page
Task/Project detail page
Implementation notes
Acceptance criteria
Implementation Spec for Issue #31
Objective
Surface cross-linked related records as clickable links on every entity detail page, making the app feel like one connected system. Each related-records section shows name + link (not raw SIDs), truncates long names with CSS ellipsis, and hides when the list is empty.
Current State Analysis
Root cause of all missing cross-links: Every
get_*_for_*method inservices/mod.rs(lines ~1292–1535) returnsOk(Vec::new())— the relationship query stubs were never implemented.Data model readiness:
Person.company_sid— can list contacts per companyContactRecord.person_sid,company_sid,contract_sid,deal_sid— can filter interactions per entityDeal.company_sid,person_sid,contract_sid— can reverse-lookup dealsContract.company_sid,person_sid— can filter contracts per entityTransaction.contract_sid— can resolve up to company/person/deal via 2-hopProject.company_sid,owner_sid— can list projects per company/personTask.project_sid,assignee_sid— company link resolved via project (2-hop)Instrument.company_sid— can list instruments per companyBugs found: The "Interactions" sections on Company, Person, and Contract detail pages already display date/type/subject rows but have no anchor tags — the records are not linked to
/interactions/{id}.Files to Modify
crates/hero_biz_ui/src/services/mod.rs— implement all stubget_*_for_*methods; add newget_persons_for_company,get_projects_for_company,get_transactions_for_company,get_transactions_for_person,get_deals_for_contractcrates/hero_biz_ui/src/web/handlers/mod.rs— updatecompanies_detail,persons_detail,deals_detail,contracts_detail,transactions_detail,tasks_detail,hr_detailto fetch newly available related recordscrates/hero_biz_ui/src/web/templates/mod.rs— updateCompanyDetailTemplate,PersonDetailTemplate,DealDetailTemplate,ContractDetailTemplate,TransactionDetailTemplate,TaskDetailTemplate,HrDetailTemplateto render new cross-link sectionsImplementation Plan
Step 1: Implement all stub store relationship query methods
Files:
crates/hero_biz_ui/src/services/mod.rsPattern:
load_all_*then.into_iter().filter(|x| x.field_sid.as_deref() == Some(target_sid)).collect()Implement:
get_contracts_for_person,get_contracts_for_company,get_contracts_for_instrumentget_contacts_for_person,get_contacts_for_company,get_contacts_for_contract,get_contacts_for_dealget_deals_for_person,get_deals_for_companyget_instruments_for_companyget_transactions_for_contractget_projects_for_personget_milestones_for_project,get_milestones_for_personget_tasks_for_project,get_tasks_for_milestone,get_tasks_for_personget_opportunities_for_person,get_opportunities_for_companyAdd new methods:
get_persons_for_company(Person hascompany_sid)get_projects_for_company(Project hascompany_sid)get_transactions_for_company(2-hop: contracts for company → transactions for each contract)get_transactions_for_person(2-hop: contracts for person → transactions for each contract)get_deals_for_contract(Deal hascontract_sid— reverse lookup)Dependencies: none
Step 2: Company detail — add Persons and Transactions sections; fix Interactions links
Files:
crates/hero_biz_ui/src/web/templates/mod.rs,crates/hero_biz_ui/src/web/handlers/mod.rspub persons: Vec<Person>,pub transactions: Vec<Transaction>,pub projects: Vec<Project>toCompanyDetailTemplatepersons_section,transactions_section,projects_sectiontorender()contacts_rowsto wrap each interaction date in<a href="{bp}/c/{context}/interactions/{id}">...</a>get_persons_for_company,get_transactions_for_company,get_projects_for_companyDependencies: Step 1
Step 3: Contact/Person detail — add Transactions section; fix Interactions links
Files:
crates/hero_biz_ui/src/web/templates/mod.rs,crates/hero_biz_ui/src/web/handlers/mod.rspub transactions: Vec<Transaction>toPersonDetailTemplatetransactions_sectiontorender()contacts_rowsto link each interaction to/interactions/{id}get_transactions_for_personDependencies: Step 1
Step 4: Deal detail — add Interactions section
Files:
crates/hero_biz_ui/src/web/templates/mod.rs,crates/hero_biz_ui/src/web/handlers/mod.rspub contacts: Vec<Contact>toDealDetailTemplatecontacts_section(interactions/follow-ups) torender()with links to/interactions/{id}get_contacts_for_dealDependencies: Step 1
Step 5: Contract detail — add Deals section; fix Interactions links
Files:
crates/hero_biz_ui/src/web/templates/mod.rs,crates/hero_biz_ui/src/web/handlers/mod.rspub deals: Vec<Deal>toContractDetailTemplatedeals_sectiontorender()with links to/deals/{id}contacts_rowsto link each interaction to/interactions/{id}get_deals_for_contractDependencies: Step 1
Step 6: Finance/Transaction detail — add Company, Person, Deal cross-links
Files:
crates/hero_biz_ui/src/web/templates/mod.rs,crates/hero_biz_ui/src/web/handlers/mod.rspub company: Option<Company>,pub person: Option<Person>,pub deal: Option<Deal>toTransactionDetailTemplatecompany_link,person_link,deal_linkrows torender()contract.company_sid), person (viacontract.person_sid), deal (viaget_deals_for_contract)Dependencies: Step 1
Step 7: Task detail — add Company cross-link via project
Files:
crates/hero_biz_ui/src/web/templates/mod.rs,crates/hero_biz_ui/src/web/handlers/mod.rspub company: Option<Company>toTaskDetailTemplateproject— ifproject.company_sidis set, load companycompany_linkrow torender()Dependencies: Step 1
Step 8: HR detail — add Contracts, Deals, Projects, Tasks sections
Files:
crates/hero_biz_ui/src/web/templates/mod.rs,crates/hero_biz_ui/src/web/handlers/mod.rspub contracts: Vec<Contract>,pub deals: Vec<Deal>,pub projects: Vec<Project>,pub tasks: Vec<Task>toHrDetailTemplaterender()get_contracts_for_person,get_deals_for_person,get_projects_for_person,get_tasks_for_personDependencies: Step 1
URL Slug Reference
/contacts/{id}/companies/{id}/interactions/{id}/deals/{id}/contracts/{id}/transactions/{id}/projects/{id}/tasks/{id}/hr/{id}Acceptance Criteria
render_linked_section)Test Results
cargo test -p hero_biz_ui— 1 test passed, 0 failed.Build: clean (
cargo build -p hero_biz_uiin 11.83s, 0 errors, 0 warnings).Implementation Summary
Closes #31.
Changes
crates/hero_biz_ui/src/services/mod.rsget_*_for_*relationship query methods (all previously returned empty)get_persons_for_company,get_projects_for_company,get_transactions_for_company,get_transactions_for_person,get_deals_for_contract,get_contacts_for_dealcrates/hero_biz_ui/src/web/handlers/mod.rscompanies_detail: fetches persons, transactions, projects for companypersons_detail: fetches transactions for persondeals_detail: fetches interactions (ContactRecords) for dealcontracts_detail: fetches deals for contracttransactions_detail: resolves company and person via contract, resolves deal via reverse lookuptasks_detail: resolves company via project (2-hop)hr_detail: fetches contracts, deals, projects, tasks for personcrates/hero_biz_ui/src/web/templates/mod.rsCompanyDetailTemplate: added Contacts, Finance, Projects sections; fixed Interactions rows to link to/interactions/{id}PersonDetailTemplate: added Finance section; fixed Interactions rows to link to/interactions/{id}DealDetailTemplate: added Interactions sectionContractDetailTemplate: added Deals section; fixed Interactions rows to link to/interactions/{id}TransactionDetailTemplate: added Company, Person, Deal cross-linksTaskDetailTemplate: added Company cross-link (resolved via project)HrDetailTemplate: wired existing Contracts, Deals, Projects, Tasks sections into HTML output (rows were built but not rendered)Notes
Instrument.company_sidandTransaction.contract_sidare plainString(notOption<String>); filter uses.as_str()comparisontask.project_sid → project.company_sid; no model change neededrender_linked_sectionhelperImplemented in commit
76347f9: surface related records as clickable cross-links on all entity detail pages (Company, Contact, Deal, Contract, Opportunity).