feat(api): improve notifications, reviews, search, and subscriptions modules

- Add listing-sold event listener with spec for notifications
- Add review-deleted event listener with spec for reviews
- Improve search handlers with proper Typesense client injection
- Improve subscription handlers with ConfigService and quota tracking

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Ho Ngoc Hai
2026-04-09 09:43:39 +07:00
parent f15e98a33b
commit e927385ed5
54 changed files with 356 additions and 82 deletions

View File

@@ -1,6 +1,6 @@
import { Inject } from '@nestjs/common';
import { type IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { CacheService, CachePrefix, CacheTTL } from '@modules/shared/infrastructure/cache.service';
import { CacheService, CachePrefix, CacheTTL } from '@modules/shared';
import {
SEARCH_REPOSITORY,
type ISearchRepository,

View File

@@ -1,6 +1,6 @@
import { Inject } from '@nestjs/common';
import { type IQueryHandler, QueryHandler } from '@nestjs/cqrs';
import { CacheService, CachePrefix, CacheTTL } from '@modules/shared/infrastructure/cache.service';
import { CacheService, CachePrefix, CacheTTL } from '@modules/shared';
import {
SEARCH_REPOSITORY,
type ISearchRepository,

View File

@@ -1,4 +1,4 @@
import { ValueObject } from '@modules/shared/domain/value-object';
import { ValueObject } from '@modules/shared';
interface GeoFilterProps {
lat: number;

View File

@@ -1,4 +1,4 @@
import { ValueObject } from '@modules/shared/domain/value-object';
import { ValueObject } from '@modules/shared';
interface SearchFilterProps {
query?: string;

View File

@@ -1 +1,2 @@
export { SearchModule } from './search.module';
export { TypesenseClientService } from './infrastructure/services/typesense-client.service';

View File

@@ -1,7 +1,6 @@
import { Injectable } from '@nestjs/common';
import { OnEvent } from '@nestjs/event-emitter';
import { CacheService, CachePrefix } from '@modules/shared/infrastructure/cache.service';
import { type LoggerService } from '@modules/shared/infrastructure/logger.service';
import { CacheService, CachePrefix, type LoggerService } from '@modules/shared';
import { type ListingIndexerService } from '../services/listing-indexer.service';
@Injectable()

View File

@@ -1,7 +1,6 @@
import { Inject, Injectable } from '@nestjs/common';
import { Prisma } from '@prisma/client';
import { type LoggerService } from '@modules/shared/infrastructure/logger.service';
import { type PrismaService } from '@modules/shared/infrastructure/prisma.service';
import { type LoggerService, type PrismaService } from '@modules/shared';
import {
SEARCH_REPOSITORY,
type ISearchRepository,

View File

@@ -1,6 +1,6 @@
import { Injectable, type OnModuleInit } from '@nestjs/common';
import { Client as TypesenseClient } from 'typesense';
import { type LoggerService } from '@modules/shared/infrastructure/logger.service';
import { type LoggerService } from '@modules/shared';
@Injectable()
export class TypesenseClientService implements OnModuleInit {

View File

@@ -1,7 +1,7 @@
import { Injectable } from '@nestjs/common';
import { type Client as TypesenseClient } from 'typesense';
import type { CollectionCreateSchema } from 'typesense/lib/Typesense/Collections';
import { type LoggerService } from '@modules/shared/infrastructure/logger.service';
import { type LoggerService } from '@modules/shared';
import {
type ISearchRepository,
type ListingDocument,

View File

@@ -12,9 +12,7 @@ import {
ApiResponse,
ApiBearerAuth,
} from '@nestjs/swagger';
import { Roles } from '@modules/auth/presentation/decorators/roles.decorator';
import { JwtAuthGuard } from '@modules/auth/presentation/guards/jwt-auth.guard';
import { RolesGuard } from '@modules/auth/presentation/guards/roles.guard';
import { Roles, JwtAuthGuard, RolesGuard } from '@modules/auth';
import { ReindexAllCommand } from '../../application/commands/reindex-all/reindex-all.command';
import { type ReindexResult } from '../../application/commands/reindex-all/reindex-all.handler';
import { GeoSearchQuery } from '../../application/queries/geo-search/geo-search.query';

View File

@@ -1,6 +1,6 @@
import { Module, type OnModuleInit } from '@nestjs/common';
import { CqrsModule } from '@nestjs/cqrs';
import { type LoggerService } from '@modules/shared/infrastructure/logger.service';
import { type LoggerService } from '@modules/shared';
import { ReindexAllHandler } from './application/commands/reindex-all/reindex-all.handler';
import { SyncListingHandler } from './application/commands/sync-listing/sync-listing.handler';
import { GeoSearchHandler } from './application/queries/geo-search/geo-search.handler';