đ AssetHierarchyController Documentation
đ QUICK DOCUMENTATIONâ
- File Path: /API/Controllers/AssetHierarchyController.cs
- Primary Purpose: Manages the asset hierarchy structure, including asset classes, types, subtypes, component types, and their relationships.
- Key Endpoints:
- đ GET /GetAssetClassNodes - Retrieves asset class hierarchy nodes
- đ GET /GetAssetTypeNodes - Retrieves asset type nodes for a specific class
- đ POST /UpdateHierarchyNode - Updates a node in the asset hierarchy
- đī¸ POST /DeleteHierarchyNode - Deletes a node from the hierarchy
- âī¸ POST /Export - Exports the full asset hierarchy to a file
- âī¸ POST /Import - Imports an asset hierarchy from a file
- Related Models: HierarchyDto, AssetClassNodeDto, AssetTypeNodeDto, AssetSubTypeNodeDto, ComponentTypeNodeDto, ComponentSubTypeNodeDto, ComponentNameNodeDto
- Used By:
- Asset hierarchy management screens
- Valuation framework configuration
- Asset classification system
- Mobile data capture application
đī¸ DETAILED DOCUMENTATIONâ
đī¸ Overviewâ
The AssetHierarchyController is responsible for managing the asset hierarchy, which is a fundamental structure in Asset Valuer Pro that defines how assets are classified and organized. The hierarchy follows a tree structure with asset classes at the top level, followed by asset types, subtypes, and finally component types and subtypes. This controller provides functionality to view, create, update, delete, and manage nodes at all levels of the hierarchy, as well as import/export capabilities.
đ§ Controller Dependenciesâ
- Namespace: AVP.API.Controllers
- Services Used:
- Mediator (CQRS pattern implementation)
- ICurrentUserService (for user context)
- BusRegistry (for V2 import functionality)
- Other Dependencies: None specified
đ Endpointsâ
đ Get Asset Class Nodesâ
- HTTP Method: GET
- URL Pattern: /GetAssetClassNodes
- Authentication: đ Required (inherited from ApiController)
- Description: Retrieves the top level of the asset hierarchy (asset classes)
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | GetAssetClassNodeQuery | Yes | Filter parameters for asset classes |
Response Formatâ
[
{
"id": 1,
"name": "Buildings",
"description": "Building assets",
"clientId": 456,
"hasChildren": true
},
{
"id": 2,
"name": "Infrastructure",
"description": "Infrastructure assets",
"clientId": 456,
"hasChildren": true
}
]
đ Get Asset Type Nodesâ
- HTTP Method: GET
- URL Pattern: /GetAssetTypeNodes
- Authentication: đ Required
- Description: Retrieves asset types for a specific asset class
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | GetAssetTypeNodeQuery | Yes | Contains AssetClassId to retrieve types |
Response Formatâ
[
{
"id": 101,
"name": "Commercial",
"description": "Commercial buildings",
"assetClassId": 1,
"hasChildren": true
},
{
"id": 102,
"name": "Residential",
"description": "Residential buildings",
"assetClassId": 1,
"hasChildren": true
}
]
đ Get Asset SubType Nodesâ
- HTTP Method: GET
- URL Pattern: /GetAssetSubTypeNodes
- Authentication: đ Required
- Description: Retrieves asset subtypes for a specific asset type
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | GetAssetSubTypeNodeQuery | Yes | Contains AssetTypeId to retrieve subtypes |
Response Formatâ
[
{
"id": 201,
"name": "Office",
"description": "Office buildings",
"assetTypeId": 101,
"hasChildren": true
},
{
"id": 202,
"name": "Retail",
"description": "Retail buildings",
"assetTypeId": 101,
"hasChildren": true
}
]
đ Update Hierarchy Nodeâ
- HTTP Method: POST
- URL Pattern: /UpdateHierarchyNode
- Authentication: đ Required
- Description: Creates or updates a node in the asset hierarchy
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | UpdateHierarchyNodeCommand | Yes | Contains node data to update |
Response Formatâ
123
(Returns the node ID)
đī¸ Delete Hierarchy Nodeâ
- HTTP Method: POST
- URL Pattern: /DeleteHierarchyNode
- Authentication: đ Required
- Description: Deletes a node from the asset hierarchy
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | DeleteHierarchyNodeCommand | Yes | Contains NodeId and NodeType to delete |
Response Formatâ
1
(Returns number of nodes deleted)
âī¸ Export Hierarchyâ
- HTTP Method: POST
- URL Pattern: /Export
- Authentication: đ Required
- Description: Exports the asset hierarchy to a downloadable file
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | ExportAssetHierarchyQuery | Yes | Export options including which parts of hierarchy to export |
Response Formatâ
File download (binary content)
âī¸ Import Hierarchyâ
- HTTP Method: POST
- URL Pattern: /Import
- Authentication: đ Required
- Description: Imports an asset hierarchy from a file
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | ImportHierarchyCommand | Yes | Contains file and import options |
Response Formatâ
{
"importedCount": 15,
"failedCount": 0,
"messages": ["Import completed successfully"]
}
đ Copy Hierarchy Nodeâ
- HTTP Method: POST
- URL Pattern: /CopyHierarchyNode
- Authentication: đ Required
- Description: Makes a copy of a hierarchy node and its children
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | CopyHierarchyNodeCommand | Yes | Contains NodeId, NodeType, and destination information |
Response Formatâ
456
(Returns the new node ID)
đ Hierarchy Structureâ
âšī¸ Note: The asset hierarchy in Asset Valuer Pro follows this structure:
-
Asset Hierarchy
- Asset Class (Buildings, Infrastructure, etc.)
- â Asset Type (Commercial, Residential, etc.)
- â â Asset SubType (Office, Retail, etc.)
-
Component Hierarchy
- Component Name (Structure, Roof, etc.)
- â Component Type (Concrete, Metal, etc.)
- â â Component SubType (Reinforced, Precast, etc.)
This controller manages both hierarchies through a common set of endpoints with the NodeType parameter indicating which hierarchy is being accessed.
đ Business Contextâ
The asset hierarchy provides critical organizational structure:
-
Classification System
- Standardized asset categorization
- Consistent naming conventions
- Hierarchical reporting capabilities
-
Valuation Framework
- Associates valuation methodologies with asset types
- Applies appropriate parameters by classification
- Ensures consistent valuation approach for similar assets
-
Data Capture Templates
- Drives mobile app data collection forms
- Ensures appropriate component collection based on asset type
- Standardizes data capture across inspectors
â ī¸ Important Considerationsâ
When working with the asset hierarchy, be aware of these constraints:
-
Dependency Management
- Nodes with children cannot be deleted directly
- Asset subtypes may have associated component configurations
- Hierarchy changes may affect valuation profiles
-
Import/Export Format
- Hierarchies are exported in a structured Excel format
- Import requires specific column headers and relationships
- Validation occurs before import to ensure data integrity