feat(api): add OpenAPI/Swagger documentation for all API endpoints
Install @nestjs/swagger, configure Swagger UI at /api/docs with JWT bearer auth, and add ApiTags/ApiOperation/ApiResponse/ApiProperty decorators to all 8 controllers (50+ endpoints) and 31 DTOs across auth, listings, search, payments, subscriptions, admin, notifications, and analytics modules. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
Get,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
||||
import { QueryBus } from '@nestjs/cqrs';
|
||||
import { GetMarketReportQuery } from '../../application/queries/get-market-report/get-market-report.query';
|
||||
import { GetHeatmapQuery } from '../../application/queries/get-heatmap/get-heatmap.query';
|
||||
@@ -17,6 +18,7 @@ import { type HeatmapDto } from '../../application/queries/get-heatmap/get-heatm
|
||||
import { type PriceTrendDto } from '../../application/queries/get-price-trend/get-price-trend.handler';
|
||||
import { type DistrictStatsDto } from '../../application/queries/get-district-stats/get-district-stats.handler';
|
||||
|
||||
@ApiTags('analytics')
|
||||
@Controller('analytics')
|
||||
export class AnalyticsController {
|
||||
constructor(
|
||||
@@ -24,6 +26,8 @@ export class AnalyticsController {
|
||||
) {}
|
||||
|
||||
@Get('market-report')
|
||||
@ApiOperation({ summary: 'Get market report for a city' })
|
||||
@ApiResponse({ status: 200, description: 'Market report retrieved' })
|
||||
async getMarketReport(@Query() dto: GetMarketReportDto): Promise<MarketReportDto> {
|
||||
return this.queryBus.execute(
|
||||
new GetMarketReportQuery(dto.city, dto.period, dto.propertyType),
|
||||
@@ -31,6 +35,8 @@ export class AnalyticsController {
|
||||
}
|
||||
|
||||
@Get('price-trend')
|
||||
@ApiOperation({ summary: 'Get price trend for a district' })
|
||||
@ApiResponse({ status: 200, description: 'Price trend data retrieved' })
|
||||
async getPriceTrend(@Query() dto: GetPriceTrendDto): Promise<PriceTrendDto> {
|
||||
return this.queryBus.execute(
|
||||
new GetPriceTrendQuery(dto.district, dto.city, dto.propertyType, dto.periods),
|
||||
@@ -38,6 +44,8 @@ export class AnalyticsController {
|
||||
}
|
||||
|
||||
@Get('heatmap')
|
||||
@ApiOperation({ summary: 'Get price heatmap for a city' })
|
||||
@ApiResponse({ status: 200, description: 'Heatmap data retrieved' })
|
||||
async getHeatmap(@Query() dto: GetHeatmapDto): Promise<HeatmapDto> {
|
||||
return this.queryBus.execute(
|
||||
new GetHeatmapQuery(dto.city, dto.period),
|
||||
@@ -45,6 +53,8 @@ export class AnalyticsController {
|
||||
}
|
||||
|
||||
@Get('district-stats')
|
||||
@ApiOperation({ summary: 'Get statistics by district' })
|
||||
@ApiResponse({ status: 200, description: 'District statistics retrieved' })
|
||||
async getDistrictStats(@Query() dto: GetDistrictStatsDto): Promise<DistrictStatsDto> {
|
||||
return this.queryBus.execute(
|
||||
new GetDistrictStatsQuery(dto.city, dto.period),
|
||||
|
||||
Reference in New Issue
Block a user