feat(listings): enrich GET /listings/:id with AVM, agent quality score, and similar count
- ListingDetailData: add valuationEstimate (AVM, cached 24 h), agentQualityScore (denormalised tier from Agent.qualityScore), similarCount, and gate inquiryCount (null for public callers; visible to listing owner or ADMIN) - listing-read.queries: select agent.qualityScore, derive tier, count similar listings in the same query via prisma.listing.count - GetListingQuery: add optional CallerContext (userId, role) for access control - GetListingHandler: inject AVM_SERVICE, fire AVM estimation with 24 h valuation cache, gracefully degrade to null on AVM failure, redact inquiryCount for non-privileged callers - OptionalJwtAuthGuard: new guard that sets request.user without throwing for anonymous requests; used on GET :id so the controller can pass caller identity to the query - ListingsModule: import AnalyticsModule so AVM_SERVICE is available for injection - CacheTTL: add VALUATION_LISTING (86400 s / 24 h) - Tests: 14 unit tests + 3 snapshot tests (public / owner / admin roles), all passing Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
export { AnalyticsModule } from './analytics.module';
|
||||
export { MARKET_INDEX_REPOSITORY, IMarketIndexRepository } from './domain/repositories/market-index.repository';
|
||||
export { VALUATION_REPOSITORY, IValuationRepository } from './domain/repositories/valuation.repository';
|
||||
export { AVM_SERVICE } from './domain/services/avm-service';
|
||||
export type { IAVMService, AVMParams, ValuationResult } from './domain/services/avm-service';
|
||||
|
||||
Reference in New Issue
Block a user