- Add NotificationChannelPort domain port for SMS/transactional channels.
- Refactor StringeeSmsService to implement the port; routes OTP template
keys through the tighter otp bucket and transactional keys through the
wider bucket.
- Add SmsRateLimiterService using a Redis sorted-set sliding window with
per-minute + per-hour limits per phone; fails open on Redis errors.
- Rate-limit violations throw DomainException(TOO_MANY_REQUESTS, 429)
with retryAfterSeconds in the details payload.
- Cover adapter + rate limiter with unit tests (22 specs); all 148
notifications tests still green.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Add emitResidentialEvent helper on NotificationsGateway that fans
residential:price-drop, residential:new-listing-in-project, and
residential:inquiry-reply to the user's /notifications room.
- Wire three CQRS @EventsHandler listeners on ListingPriceChangedEvent
(only when newPrice < oldPrice, match saved searches),
ListingApprovedEvent (match saved searches with filters.projectId
against property.projectDevelopmentId), and InquiryReadEvent
(notify inquiry author).
- Redis pub/sub fan-out already handled by RedisIoAdapter from
TEC-2766, so these broadcasts work across API instances.
- Unit tests for all three listeners and the new gateway helper.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- libs/ai-services: new POST /neighborhood/score router computing weighted
6-axis livability score from per-category POI counts; algorithm versioned
for future iteration (sigmoid curves, percentile thresholds).
- apps/api: HttpNeighborhoodScoreService proxies to Python first, falls back
to PrismaNeighborhoodScoreService when AI service unavailable. Mirrors the
HttpAVMService pattern. Existing GET /analytics/neighborhoods/:district/score
endpoint and CQRS handler now flow through the proxy.
- AnalyticsModule binds Http variant by default, retains Prisma variant as
injectable fallback.
- Tests: 5 pytest cases for Python heuristic, 4 vitest cases for HTTP proxy
fallback behaviour.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Add RedisIoAdapter (shared/infra) for multi-instance Socket.IO fan-out
with graceful fallback to the in-memory IoAdapter when Redis is
unreachable.
- Pin Socket.IO heartbeat (pingInterval/pingTimeout/connectTimeout)
via env-tunable gateway options for reconnect stability.
- Expose Prometheus metrics on /notifications: goodgo_ws_connected_clients
(Gauge) and goodgo_ws_messages_total (Counter) with namespace/event/
direction labels. Wired through MetricsService and tracked across
connect/disconnect + emits.
- Unit tests: RedisIoAdapter connect/fallback/close, new MetricsService
WS helpers, and gateway metric increments/decrements on auth paths.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
TEC-2722 — PATCH /api/v1/auth/profile now accepts phoneNumber alongside
fullName, avatarUrl, and email. Phone changes are deferred until the user
confirms the SMS OTP via POST /api/v1/auth/profile/verify-phone, mirroring
the existing email-change OTP flow.
- Add PhoneChangeRequestedEvent + user.phone_change_otp SMS template
- Add VerifyPhoneChangeHandler with Redis-backed 10-minute OTP
- Re-check phone uniqueness at verify time to catch races
- Extend unit tests for UpdateProfileHandler + add VerifyPhoneChangeHandler spec
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Add unit tests for FeatureListingHandler (6 tests) and ActivateFeaturedListingHandler (6 tests)
- Add unit tests for NeighborhoodScoreServiceImpl (5 tests) and GetNeighborhoodScoreHandler (2 tests)
- Add PriceHistoryChart component with recharts LineChart for listing detail page
- Wire up price history API client and integrate chart into listing detail view
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Wire NestJS controller to Python AI service's industrial AVM. Adds CQRS
query/handler, Swagger-annotated DTOs, AI client method, and 7 unit tests
covering parameter mapping, response camelCase conversion, and error handling.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add minPrice/maxPrice inputs to ProjectFilterBar and introduce a
list view mode alongside the existing grid/map toggle for project
browsing.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add comprehensive test coverage for the three AVM API upgrade endpoints:
- BatchValuationHandler: batch results, partial failures, error handling
- ValuationHistoryHandler: history retrieval, limit, empty state, errors
- ValuationComparisonHandler: multi-property compare, summary, edge cases
- AnalyticsController: route-level tests for all new endpoints
Fix async error handling in handlers by adding await to cache.getOrSet
calls so try/catch blocks properly catch rejections.
Fix pre-existing web test failures: add missing FLOOD_RISK_OPTIONS and
QUALITY_LABELS to valuation-form mock, update valuation-results assertions
to match current component rendering.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Wire full DDD stack for IndustrialListing: domain entity, repository interface,
CQRS commands/queries with handlers, Prisma repository, Typesense sync on
create/update/delete, controller with 5 REST endpoints, and validated DTOs.
Register all providers in IndustrialModule.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add POST /transfer/estimate-from-photos endpoint that uses Claude Vision API
to assess furniture/appliance condition from photos, integrating with the
existing rule-based pricing engine. Includes rate limiting (5/min), image hash
caching, graceful fallback, and 17 unit tests covering all paths.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Remove duplicate minio-pdf-storage and puppeteer-pdf services, keeping
the consolidated versions in pdf-generator.service.ts and pdf-storage.service.ts.
Update reports module imports to use the correct classes.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Featured listings now sort first in search results via featuredUntil desc ordering.
All listing read DTOs (detail, search, seller) include isFeatured boolean and featuredUntil timestamp.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add three new NestJS modules following DDD/CQRS architecture:
- Industrial: KCN (industrial park) management with PostGIS geo queries, Typesense search, and market statistics
- Transfer: Furniture/premises transfer listings with AI-powered price estimation and depreciation modeling
- Reports: Async AI report generation via BullMQ with Claude narrative service, PDF generation, and macro data integration
Includes Prisma schema models, migrations, seed scripts, and app.module wiring with BullMQ Redis config.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Add mediaOrder field to UpdateListingDto, Command, and Handler for
reordering media items
- Add updateMediaOrder method to IPropertyRepository and Prisma impl
- Fix PrismaPropertyRepository.update() to persist amenities, nearbyPOIs,
floors, floor, totalFloors, and metroDistanceM columns
- Add unit tests for media order updates in handler spec
- Add DTO validation tests for mediaOrder with nested validation
- Add e2e integration tests covering content updates, auth, ownership
guard, and forbidden field rejection
Existing guards enforced:
- Only seller or assigned agent can update (403 for others)
- ACTIVE listings transition to PENDING_REVIEW on edit
- propertyType, address, location blocked via DTO whitelist
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Create INeighborhoodScoreService interface and implementation
- Score districts 0-100 across 6 categories: education, healthcare, transport, shopping, greenery, safety
- Calculate scores from POI data with configurable weights and max counts
- Add GetNeighborhoodScoreQuery handler with lazy calculation
- Add GET /analytics/neighborhoods/:district/score endpoint
- Wire service and handler into AnalyticsModule
Co-Authored-By: Paperclip <noreply@paperclip.ing>
- Add SocialShare component with copy-link, Facebook, Zalo, and QR code sharing
- Integrate price history chart and social sharing into listing detail page
- Register new price history and feature-listing handlers in ListingsModule
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Auto-fix 862 lint errors: convert value imports used only as types to
`import type`, fix import group ordering in seed.ts and du-an-api.ts,
remove unused imports in auth controller, and clean up stale eslint-disable
comments referencing non-existent rules.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Wire up PATCH /listings/:id with UpdateListingCommand/Handler, add QR code
image endpoint, extend IMediaStorageService with generatePresignedUpload and
getPublicUrl, and include UpdateListingDto unit tests.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add batch valuation (POST /analytics/valuation/batch, max 50 properties),
valuation comparison (POST /analytics/valuation/compare, 2-5 properties),
and history endpoint (GET /analytics/valuation/history/:propertyId) with
confidence explanation helper. Frontend: enhanced valuation form with project
autocomplete and deep analysis toggle, results with confidence badges and
price range visualization, comparables table, history chart, market context
card, and PDF export.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
The ConfirmBankTransfer command, handler, result type, and DTO were implemented
but not exported from their respective index files, making them inaccessible
to consumers importing from the barrel.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
The findByIdWithProperty and searchListings read queries used
`?? { latitude: 0, longitude: 0 }` fallbacks after PostGIS coordinate
extraction. Since the Property.location column is NOT NULL, these
fallbacks silently masked potential data issues. Replaced with non-null
assertions since geo data is guaranteed to exist for valid properties.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Email changes via PATCH /api/v1/auth/profile now require OTP verification
instead of updating immediately. A 6-digit code is sent to the new email
address and must be confirmed via POST /api/v1/auth/profile/verify-email
within 10 minutes. Also fixes pre-existing web valuation test failures
(formatPrice output format, removed comparables section, missing
QueryClientProvider wrapper).
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Add BANK_TRANSFER as a fully supported payment provider:
- BankTransferService implementing IPaymentGateway with HMAC-SHA256 verification
- ConfirmBankTransferCommand/Handler for admin manual payment confirmation
- POST /payments/:id/confirm-transfer admin endpoint (RBAC-protected)
- Atomic status updates with idempotency (PENDING/PROCESSING → COMPLETED)
- Registered in PaymentGatewayFactory alongside VNPAY, MOMO, ZALOPAY
- Comprehensive unit tests for service and handler
Co-Authored-By: Paperclip <noreply@paperclip.ing>
findByIdWithProperty and searchListings used Prisma include which cannot
extract PostGIS geometry(Point,4326) columns. Added raw SQL with ST_Y/ST_X
to return actual lat/lng. Search uses batch extraction via ANY() for efficiency.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Implement user profile update with fullName, avatarUrl, and email fields.
Email changes include uniqueness validation and Email VO verification.
Follows existing DDD/CQRS patterns with cache invalidation.
19 unit tests covering handler logic and DTO validation.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
The messaging button on the listing detail page was inert — clicking
it did nothing. This commit completes the inquiry flow:
- Add CreateInquiryDto and create() method to inquiries API client
- Add useCreateInquiry React Query mutation hook
- Wire onClick handler on the Nhắn tin button to open InquiryModal
- Add InquiryModal mock in listing-detail-client tests for isolation
- InquiryModal component (added in prior commit) provides the full
form with phone pre-fill, validation, success/error states
All 593 web tests pass.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Previously, `docker image prune` ran immediately after deploying new
containers, potentially deleting the old images needed for rollback
if smoke tests subsequently failed. Now the deploy pipeline:
1. Tags current images as :rollback before pulling new versions
2. Only runs `docker image prune` after smoke tests pass
3. Uses explicit :rollback tags for rollback instead of relying on
Docker layer cache (which is fragile)
Applied to:
- scripts/deploy-production.sh (manual deploy script)
- .github/workflows/deploy.yml (staging + production CI jobs)
- docs/deployment.md (updated rollback documentation)
Co-Authored-By: Paperclip <noreply@paperclip.ing>
Property toDomain() was hardcoding GeoPoint.create(0, 0) because Prisma
returns PostGIS geometry(Point, 4326) as an opaque Unsupported type.
Changed findById to use raw SQL with ST_Y/ST_X extraction, ensuring
actual coordinates round-trip correctly through save → query.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
crossOriginResourcePolicy: 'same-origin' blocks browser fetch from
platform.goodgo.vn to api.goodgo.vn. Changed to 'cross-origin'.
Also disabled crossOriginEmbedderPolicy which conflicts with CORS.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@goodgo/mcp-servers is a workspace dependency used at runtime.
Need to copy its package.json for pnpm install resolution and
its compiled dist/ output into the production image.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@nestjs/config is used at runtime (ConfigModule in shared.module)
but was incorrectly in devDependencies, causing MODULE_NOT_FOUND
when running with --prod install.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
pnpm hoisted node_modules uses symlinks that break when copied between
Docker stages. Install production deps fresh in final stage instead.
Set WORKDIR to /app/apps/api so dist/main resolves correctly.
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
pnpm deploy --legacy --prod doesn't resolve all transitive deps correctly
in monorepo. Copy full node_modules from build stage instead. Also add
openssl to production image (required by Prisma at runtime).
Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>