feat(web): add price range filter and list view to /du-an page
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>
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Get,
|
||||
Param,
|
||||
Post,
|
||||
Query,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { type QueryBus } from '@nestjs/cqrs';
|
||||
import { ApiTags, ApiOperation, ApiResponse, ApiBearerAuth, ApiParam, ApiQuery } from '@nestjs/swagger';
|
||||
import { JwtAuthGuard } from '@modules/auth';
|
||||
import { EndpointRateLimit, EndpointRateLimitGuard } from '@modules/shared';
|
||||
import { RequireQuota, QuotaGuard } from '@modules/subscriptions';
|
||||
import { type BatchValuationDto as BatchValuationResultDto } from '../../application/queries/batch-valuation/batch-valuation.handler';
|
||||
import { BatchValuationQuery } from '../../application/queries/batch-valuation/batch-valuation.query';
|
||||
import { type ValuationComparisonDto as ValuationComparisonResultDto } from '../../application/queries/valuation-comparison/valuation-comparison.handler';
|
||||
import { ValuationComparisonQuery } from '../../application/queries/valuation-comparison/valuation-comparison.query';
|
||||
import { type ValuationHistoryDto as ValuationHistoryResultDto } from '../../application/queries/valuation-history/valuation-history.handler';
|
||||
import { ValuationHistoryQuery } from '../../application/queries/valuation-history/valuation-history.query';
|
||||
import { type AvmCompareQueryDto } from '../dto/avm-compare-query.dto';
|
||||
import { type BatchValuationDto } from '../dto/batch-valuation.dto';
|
||||
import { type ValuationHistoryDto } from '../dto/valuation-history.dto';
|
||||
|
||||
@ApiTags('avm')
|
||||
@Controller('avm')
|
||||
export class AvmController {
|
||||
constructor(
|
||||
private readonly queryBus: QueryBus,
|
||||
) {}
|
||||
|
||||
@ApiBearerAuth('JWT')
|
||||
@EndpointRateLimit({ limit: 10, windowSeconds: 60, keyStrategy: 'user' })
|
||||
@UseGuards(EndpointRateLimitGuard, JwtAuthGuard, QuotaGuard)
|
||||
@RequireQuota('analytics_queries')
|
||||
@Post('batch')
|
||||
@ApiOperation({ summary: 'Batch valuation for multiple properties (max 50)' })
|
||||
@ApiResponse({ status: 200, description: 'Batch valuation results' })
|
||||
@ApiResponse({ status: 400, description: 'Invalid parameters' })
|
||||
@ApiResponse({ status: 403, description: 'Quota exceeded' })
|
||||
@ApiResponse({ status: 429, description: 'Rate limit exceeded — max 10 requests per 60s' })
|
||||
async batchValuation(@Body() dto: BatchValuationDto): Promise<BatchValuationResultDto> {
|
||||
return this.queryBus.execute(
|
||||
new BatchValuationQuery(dto.propertyIds),
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBearerAuth('JWT')
|
||||
@UseGuards(JwtAuthGuard, QuotaGuard)
|
||||
@RequireQuota('analytics_queries')
|
||||
@Get('history/:propertyId')
|
||||
@ApiOperation({ summary: 'Get valuation history for a property (time-series)' })
|
||||
@ApiParam({ name: 'propertyId', description: 'Property ID', example: 'prop-123' })
|
||||
@ApiResponse({ status: 200, description: 'Valuation history time-series data' })
|
||||
@ApiResponse({ status: 403, description: 'Quota exceeded' })
|
||||
async getHistory(
|
||||
@Param('propertyId') propertyId: string,
|
||||
@Query() dto: ValuationHistoryDto,
|
||||
): Promise<ValuationHistoryResultDto> {
|
||||
return this.queryBus.execute(
|
||||
new ValuationHistoryQuery(propertyId, dto.limit ?? 50),
|
||||
);
|
||||
}
|
||||
|
||||
@ApiBearerAuth('JWT')
|
||||
@EndpointRateLimit({ limit: 10, windowSeconds: 60, keyStrategy: 'user' })
|
||||
@UseGuards(EndpointRateLimitGuard, JwtAuthGuard, QuotaGuard)
|
||||
@RequireQuota('analytics_queries')
|
||||
@Get('compare')
|
||||
@ApiOperation({ summary: 'Compare valuations for 2-5 properties side by side' })
|
||||
@ApiQuery({
|
||||
name: 'ids',
|
||||
description: 'Comma-separated property IDs (2-5)',
|
||||
example: 'prop-1,prop-2,prop-3',
|
||||
type: String,
|
||||
})
|
||||
@ApiResponse({ status: 200, description: 'Normalized comparison data for UI' })
|
||||
@ApiResponse({ status: 400, description: 'Invalid parameters — provide 2-5 property IDs' })
|
||||
@ApiResponse({ status: 403, description: 'Quota exceeded' })
|
||||
@ApiResponse({ status: 429, description: 'Rate limit exceeded — max 10 requests per 60s' })
|
||||
async compare(@Query() dto: AvmCompareQueryDto): Promise<ValuationComparisonResultDto> {
|
||||
return this.queryBus.execute(
|
||||
new ValuationComparisonQuery(dto.ids),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
export { AnalyticsController } from './analytics.controller';
|
||||
export { AvmController } from './avm.controller';
|
||||
|
||||
Reference in New Issue
Block a user