Ho Ngoc Hai
36e0f49e9e
feat(auth): add handler specs and improve auth infrastructure
...
Add unit tests for get-profile, get-agent-by-user-id, and verify-kyc handlers.
Improve OAuth service, local strategy, and repository implementations with
proper ConfigService injection and error handling.
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-09 09:42:16 +07:00
Ho Ngoc Hai
8705a2d9a8
fix: resolve all ESLint errors across API and web packages
...
Fix 19+ lint errors: unused imports (Phone, DuplicateCandidate, listingDetailsSchema),
import ordering violations, consistent-type-imports, and constant binary expression
in test file.
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 16:29:44 +07:00
Ho Ngoc Hai
bac3313873
test(auth,payments,subs): add 58 unit tests for critical auth, payment, and subscription paths
...
Cover auth handlers (RegisterUser, LoginUser, RefreshToken), TokenService
(token rotation, reuse attack detection), payment callback edge cases
(duplicate/concurrent callbacks, multi-provider), subscription lifecycle
transitions (expire, pastDue, renew), and throttler proxy guard.
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 13:49:19 +07:00
Ho Ngoc Hai
2502aa69b7
fix: production readiness — resolve build, lint, and code quality issues
...
- Fix Next.js build failure: remove duplicate route at (dashboard)/listings/[id]
that conflicted with (public)/listings/[id] (same URL path in two route groups)
- Fix 772 ESLint errors: auto-fix import ordering (import-x/order), remove unused
imports/variables, convert empty interfaces to type aliases, replace require()
with ESM imports, fix consistent-type-imports violations
- Add CLAUDE.md for developer onboarding documentation
- All checks pass: 0 lint errors, typecheck clean, 230 tests passing, build success
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 07:15:06 +07:00
Ho Ngoc Hai
e9889539ea
fix: eliminate untyped repository returns and standardize DomainException usage across all handlers
...
- Create typed DTOs (ListingDetailData, ListingSearchItem, ListingSellerItem) for repository read methods
- Replace all Promise<any> and PaginatedResult<any> with concrete types in repository interface and implementation
- Remove `as any` casts in search params by using Prisma enum types (TransactionType, PropertyType)
- Migrate all 16 handlers from NestJS built-in exceptions to domain exceptions (NotFoundException, ValidationException, etc.)
- Add CONTRIBUTING.md documenting error handling convention
- All 230 tests pass, typecheck clean
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 06:25:44 +07:00
Ho Ngoc Hai
2a392525a2
feat(cache): implement Redis caching layer for hot-read endpoints
...
Add cache-aside pattern for listing detail, search results, market
analytics (4 endpoints), and user profile queries. Cache invalidation
on all write mutations. Prometheus cache_hit_total/cache_miss_total
metrics with resource labels.
- CacheService: getOrSet, invalidate, invalidateByPrefix (SCAN-based)
- TTLs: listing 5m, search 1m, market 30m, profile 10m
- All 230 tests passing (13 new cache tests + 6 updated handler tests)
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 04:14:06 +07:00
Ho Ngoc Hai
391c040100
feat(auth): implement Auth module with register, login, JWT, guards, and CQRS
...
- Add RefreshToken and OAuthAccount models to Prisma schema
- Implement clean architecture: domain (entities, VOs, events, repo interfaces),
infrastructure (Prisma repos, Passport strategies, token service),
application (CQRS command/query handlers), presentation (controller, guards, DTOs)
- Endpoints: POST /auth/register, /auth/login, /auth/refresh, GET /auth/profile,
GET /auth/profile/agent, PATCH /auth/kyc
- JWT access + refresh token rotation with family-based revocation
- Role-based guards (BUYER, SELLER, AGENT, ADMIN)
- 16 unit tests (value objects, entity) + integration test suite
- All 80 tests passing, clean TypeScript build
Co-Authored-By: Paperclip <noreply@paperclip.ing >
2026-04-08 00:24:42 +07:00