feat(web): add social share component and wire price history into listing detail
- 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>
This commit is contained in:
@@ -2,10 +2,12 @@ import { Module } from '@nestjs/common';
|
||||
import { CqrsModule } from '@nestjs/cqrs';
|
||||
import { MulterModule } from '@nestjs/platform-express';
|
||||
import { CreateListingHandler } from './application/commands/create-listing/create-listing.handler';
|
||||
import { FeatureListingHandler } from './application/commands/feature-listing/feature-listing.handler';
|
||||
import { ModerateListingHandler } from './application/commands/moderate-listing/moderate-listing.handler';
|
||||
import { UpdateListingHandler } from './application/commands/update-listing/update-listing.handler';
|
||||
import { UpdateListingStatusHandler } from './application/commands/update-listing-status/update-listing-status.handler';
|
||||
import { UploadMediaHandler } from './application/commands/upload-media/upload-media.handler';
|
||||
import { ActivateFeaturedListingHandler } from './application/event-handlers/activate-featured-listing.handler';
|
||||
import { RecordPriceHistoryHandler } from './application/event-handlers/record-price-history.handler';
|
||||
import { GetListingHandler } from './application/queries/get-listing/get-listing.handler';
|
||||
import { GetPendingModerationHandler } from './application/queries/get-pending-moderation/get-pending-moderation.handler';
|
||||
@@ -25,6 +27,7 @@ import { ListingsController } from './presentation/controllers/listings.controll
|
||||
|
||||
const CommandHandlers = [
|
||||
CreateListingHandler,
|
||||
FeatureListingHandler,
|
||||
UpdateListingHandler,
|
||||
UpdateListingStatusHandler,
|
||||
UploadMediaHandler,
|
||||
@@ -39,6 +42,7 @@ const QueryHandlers = [
|
||||
];
|
||||
|
||||
const EventHandlers = [
|
||||
ActivateFeaturedListingHandler,
|
||||
RecordPriceHistoryHandler,
|
||||
];
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ import { SearchListingsQuery } from '../../application/queries/search-listings/s
|
||||
import type { ListingDetailData, ListingSearchItem } from '../../domain/repositories/listing-read.dto';
|
||||
import type { PaginatedResult } from '../../domain/repositories/listing.repository';
|
||||
import type { CreateListingDto } from '../dto/create-listing.dto';
|
||||
import type { FeatureListingDto } from '../dto/feature-listing.dto';
|
||||
import type { ModerateListingDto } from '../dto/moderate-listing.dto';
|
||||
import { type SearchListingsDto } from '../dto/search-listings.dto';
|
||||
import type { UpdateListingStatusDto } from '../dto/update-listing-status.dto';
|
||||
@@ -297,4 +298,24 @@ export class ListingsController {
|
||||
new ModerateListingCommand(id, user.sub, dto.action, dto.moderationScore, dto.notes),
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBearerAuth('JWT')
|
||||
@ApiOperation({ summary: 'Feature a listing (creates payment for featured boost)' })
|
||||
@ApiParam({ name: 'id', description: 'Listing UUID' })
|
||||
@ApiResponse({ status: 201, description: 'Payment created for featured listing' })
|
||||
@ApiResponse({ status: 400, description: 'Invalid package or listing not ACTIVE' })
|
||||
@ApiResponse({ status: 401, description: 'Unauthorized' })
|
||||
@ApiResponse({ status: 403, description: 'Not the seller or assigned agent' })
|
||||
@UseGuards(JwtAuthGuard)
|
||||
@Post(':id/feature')
|
||||
async featureListing(
|
||||
@Param('id') id: string,
|
||||
@Body() dto: FeatureListingDto,
|
||||
@CurrentUser() user: JwtPayload,
|
||||
@Ip() ip: string,
|
||||
): Promise<FeatureListingResult> {
|
||||
return this.commandBus.execute(
|
||||
new FeatureListingCommand(id, user.sub, dto.package, dto.provider, dto.returnUrl, ip),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user