đ§ JobController Documentation
đ§ QUICK DOCUMENTATIONâ
- File Path: API/Controllers/JobController.cs
- Primary Purpose: Manages valuation job lifecycle including creation, retrieval, updates, archiving, and data refresh operations.
- Key Endpoints:
- đ GET /List - Retrieves list of valuation jobs
- đ GET /Get - Gets a specific job by ID
- âī¸ POST /Update - Updates job details
- âī¸ POST /Archive - Archives a completed job
- đ GET /RefreshReportData - Recalculates valuation data for reports
- Related Models: JobDto, JobAssetSummaryDto, DropDownDto
- Used By:
- Job creation and management screens
- Valuation process workflow
- Reporting system
đ DETAILED DOCUMENTATIONâ
đī¸ Overviewâ
The JobController handles all aspects of valuation job management, which is a core concept in the Asset Valuer Pro application. A "job" represents a specific valuation assignment with defined parameters, assets, and effective dates. This controller enables creating, retrieving, updating, and archiving jobs, as well as managing associated data such as images and documents.
đī¸ Controller Dependenciesâ
- Namespace: AVP.API.Controllers
- Services Used:
- Mediator (CQRS pattern implementation)
- BusRegistry (for V2 import functionality)
- Other Dependencies: Rate limiting for resource-intensive operations
đ§ Endpointsâ
đ List Jobsâ
- HTTP Method: GET
- URL Pattern: /List
- Authentication: Required (inherited from ApiController)
- Description: Retrieves a list of jobs based on query parameters
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | JobListQuery | Yes | Query parameters for filtering jobs |
Response Formatâ
[
{
"id": 123,
"name": "Example Job",
"clientId": 456,
"status": "Open",
"effectiveDate": "2025-01-15T00:00:00Z"
}
]
đ Get Job By IDâ
- HTTP Method: GET
- URL Pattern: /Get
- Authentication: Required
- Description: Retrieves a specific job by its ID
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| query | GetJobQuery | Yes | Contains JobId to retrieve |
Response Formatâ
{
"id": 123,
"name": "Example Job",
"clientId": 456,
"status": "Open",
"effectiveDate": "2025-01-15T00:00:00Z",
"description": "Annual valuation for Client X",
"assetClassIds": [1, 2, 3]
}
âī¸ Update Jobâ
- HTTP Method: POST
- URL Pattern: /Update
- Authentication: Required
- Description: Updates job properties
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | UpdateJobCommand | Yes | Contains updated job data |
Response Formatâ
123
(Returns the job ID)
âī¸ Archive Jobâ
- HTTP Method: POST
- URL Pattern: /Archive
- Authentication: Required
- Description: Archives a completed job, generating snapshot reports for future reference
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | ArchiveJobCommand | Yes | Contains JobId and optional parameters |
Response Formatâ
{
"message": "Job successfully archived"
}
đ Refresh Report Dataâ
- HTTP Method: GET
- URL Pattern: /RefreshReportData
- Authentication: Required
- Description: Recalculates all valuation data for a job, typically run after data changes
Request Parametersâ
| Parameter | Type | Required | Description |
|---|---|---|---|
| command | RefreshJobDataCommand | Yes | Contains JobId to refresh |
Response Formatâ
"Refresh completed successfully"
đ Business Contextâ
đ Centrality to Valuation Processâ
According to the legacy documentation, the "Job" concept is a foundational element in Asset Valuer Pro. The JobController implements several key business requirements:
-
Valuation Isolation
- The legacy documentation emphasizes that "the valuation process must be undertaken external to any live data held in an entity's ERP or finance system"
- Jobs provide this isolation by creating a contained environment for the valuation process
- The controller ensures this separation through its job creation and management endpoints
-
Point-in-Time Valuation
- The legacy documentation states that "a valuation is undertaken at a point in time"
- The controller manages the "EffectiveDateOfValuation" which is described as "usually the first or last day of the financial year"
- This ensures all valuations within a job reference the same effective date
-
Asset Class Selection
- The legacy documentation mentions "creating a valuation 'Job' (requires allocating 'asset classes' to the 'job')"
- The Update endpoint supports this business requirement by allowing asset classes to be associated with a job
đ Job Status Lifecycleâ
The JobController implements the job status lifecycle described in the legacy documentation:
-
Open - Active job where changes can be made
- This is the initial state when created through the controller
- Allows data collection and modification
-
Draft - Pending client feedback with possible changes
- The controller supports transitioning to this state when the valuation is ready for client review
-
Finalised - Client has accepted results
- The controller enables finalizing a job when client approval is received
-
Archived - Job is completed and preserved for historical reference
- The Archive endpoint implements this state transition
- The legacy documentation notes that archiving "access the final figures and raw data and records them as the 'previous years' figures"
đ Data Refresh Functionalityâ
The RefreshReportData endpoint is particularly important to the business process. The legacy documentation states:
"Once all data is populated the valuer refreshes all the calculations. This process reads the raw data (such as asset hierarchy), accesses relevant information (based on the hierarchy) from the assumptions table and populates relevant fields..."
This calculation refresh is essential to generate accurate valuation results and must be performed whenever significant data changes occur.
đ Security Considerationsâ
âšī¸ Note: All endpoints in this controller require authentication. The RefreshReportData endpoint is also rate-limited due to its resource-intensive nature.
⥠Performance Considerationsâ
đĄ Tip: The RefreshReportData endpoint can be resource-intensive for large jobs. Consider implementing a background processing approach for very large datasets.