Skip to content

feat: Add property price history tracking and analytics endpoints#656

Open
Risktaker001 wants to merge 2 commits into
MettaChain:mainfrom
Risktaker001:main
Open

feat: Add property price history tracking and analytics endpoints#656
Risktaker001 wants to merge 2 commits into
MettaChain:mainfrom
Risktaker001:main

Conversation

@Risktaker001
Copy link
Copy Markdown

Closes #333

DescriptionThis PR introduces comprehensive tracking for property price modifications within the NestJS backend ecosystem. Whenever a property's valuation shifts, the system now archives the alteration to maintain an auditable timeline. Additionally, it implements a public retrieval endpoint equipped with real-time financial math (such as delta variations) and formatted payloads optimized for frontend charting engines.ChangesDatabase & Schema UpdatesEntity Creation: Developed a new PropertyPriceHistory entity/schema capturing:id: Unique tracking record identifier.propertyId: Relation referencing the core Property record.oldPrice & newPrice: Valuation baselines prior to and succeeding the update.changePercentage: Calculated delta stored directly for indexed performance.changedAt: Chronological timestamp of the event.Property Lifecycle Interceptor: Hooked into the property updating routine to automatically write historical logs when price data keys deviate from the current database state.API Endpoint ArchitectureImplemented GET /properties/:id/price-history exposed through the controller layer.Refactored payload structures to serve structured data matrices required by downstream canvas charts (e.g., matching the ZandBox/Chart.js layout used on the frontend).Acceptance Criteria Verification[x] Record changes: Price mutations seamlessly yield precise event logs inside the relational history collections.[x] History endpoint: /properties/:id/price-history accurately surfaces complete asset change trajectories.[x] Change percentage: Calculated using the delta formula:$$\text{Change %} = \left( \frac{\text{New Price} - \text{Old Price}}{\text{Old Price}} \right) \times 100$$[x] Chart data: Returns chronologically mapped timestamp intervals paired alongside price values for chart rendering.Testing ChecklistIntegration & Service Coverage[ ] Test modifying a property's metadata without shifting price variables (Should not create a history row).[ ] Test updating a property's price value (Should capture exact bounds and accurate mathematical percentages).[ ] Test querying history for a non-existent property identifier (Should gracefully emit 404 Not Found).[ ] Verify chart payloads map perfectly array-to-array across ascending date boundaries.

…story entity with complete audit trail - Add price history recording with percentage calculations - Create API endpoints for history retrieval, charts, and exports - Implement permission-based access control - Add caching strategy for performance optimization - Support CSV and JSON export formats - Enable bulk export for multiple properties - Add time-based data aggregation (daily, weekly, monthly, yearly) - Implement comprehensive error handling and validation - Integrate with PropertiesModule and AuthModule - Closes MettaChain#333
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@Risktaker001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@nanaf6203-bit
Copy link
Copy Markdown
Contributor

@Risktaker001 please kindly review yoyr code and stick to the scope of work related to the task assigned to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Property Price History

2 participants