Files
goodgo-platform/apps/api/src/modules/auth/index.ts
Ho Ngoc Hai 805aaeffad 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>
2026-04-21 02:43:56 +07:00

20 lines
1.4 KiB
TypeScript

export { AuthModule } from './auth.module';
export { JwtAuthGuard } from './presentation/guards/jwt-auth.guard';
export { OptionalJwtAuthGuard } from './presentation/guards/optional-jwt-auth.guard';
export { RolesGuard } from './presentation/guards/roles.guard';
export { Roles } from './presentation/decorators/roles.decorator';
export { CurrentUser } from './presentation/decorators/current-user.decorator';
export { TokenService, type JwtPayload, type TokenPair, type RotateResult } from './infrastructure/services/token.service';
export { UserEntity, type UserProps } from './domain/entities/user.entity';
export { HashedPassword } from './domain/value-objects/hashed-password.vo';
export { Phone } from './domain/value-objects/phone.vo';
export { AgentVerifiedEvent } from './domain/events/agent-verified.event';
export { UserDeactivatedEvent } from './domain/events/user-deactivated.event';
export { UserKycUpdatedEvent } from './domain/events/user-kyc-updated.event';
export { UserRegisteredEvent } from './domain/events/user-registered.event';
export { EmailChangeRequestedEvent } from './domain/events/email-change-requested.event';
export { PhoneChangeRequestedEvent } from './domain/events/phone-change-requested.event';
export { EmailChangedEvent } from './domain/events/email-changed.event';
export { PhoneChangedEvent } from './domain/events/phone-changed.event';
export { USER_REPOSITORY, IUserRepository } from './domain/repositories/user.repository';