This commit is contained in:
2026-04-16 17:21:48 +03:00
parent c8fa4c442d
commit c8e7e4e927
116 changed files with 3720 additions and 4197 deletions
@@ -7,24 +7,24 @@ import {
HttpCode,
HttpStatus,
NotFoundException,
} from '@nestjs/common';
import { ApiTags, ApiOperation, ApiResponse, ApiParam } from '@nestjs/swagger';
import { PredictionsService } from './predictions.service';
} from "@nestjs/common";
import { ApiTags, ApiOperation, ApiResponse, ApiParam } from "@nestjs/swagger";
import { PredictionsService } from "./predictions.service";
import {
MatchPredictionDto,
PredictionHistoryResponseDto,
UpcomingPredictionsDto,
ValueBetDto,
AIHealthDto,
} from './dto';
} from "./dto";
import {
GeneratePredictionDto,
SmartCouponRequestDto,
} from './dto/predictions-request.dto';
import { Public } from 'src/common/decorators';
} from "./dto/predictions-request.dto";
import { Public } from "src/common/decorators";
@ApiTags('Predictions')
@Controller('predictions')
@ApiTags("Predictions")
@Controller("predictions")
export class PredictionsController {
constructor(private readonly predictionsService: PredictionsService) {}
@@ -32,8 +32,8 @@ export class PredictionsController {
* GET /predictions/health
* Check AI Engine health status
*/
@Get('health')
@ApiOperation({ summary: 'Check AI Engine health status' })
@Get("health")
@ApiOperation({ summary: "Check AI Engine health status" })
@ApiResponse({ status: 200, type: AIHealthDto })
async checkHealth(): Promise<AIHealthDto> {
return this.predictionsService.checkHealth();
@@ -43,8 +43,8 @@ export class PredictionsController {
* GET /predictions/upcoming
* Get predictions for upcoming matches
*/
@Get('upcoming')
@ApiOperation({ summary: 'Get predictions for upcoming matches' })
@Get("upcoming")
@ApiOperation({ summary: "Get predictions for upcoming matches" })
@ApiResponse({ status: 200, type: UpcomingPredictionsDto })
async getUpcoming(): Promise<UpcomingPredictionsDto> {
return this.predictionsService.getUpcomingPredictions();
@@ -54,10 +54,10 @@ export class PredictionsController {
* GET /predictions/test/:id
* Refetch match data and get prediction
*/
@Get('test/:id')
@ApiOperation({ summary: 'Refetch match data and get prediction' })
@ApiParam({ name: 'id', description: 'Match ID' })
async getTestPrediction(@Param('id') id: string) {
@Get("test/:id")
@ApiOperation({ summary: "Refetch match data and get prediction" })
@ApiParam({ name: "id", description: "Match ID" })
async getTestPrediction(@Param("id") id: string) {
return this.predictionsService.testPrediction(id);
}
@@ -65,8 +65,8 @@ export class PredictionsController {
* GET /predictions/value-bets
* Get EV+ betting opportunities
*/
@Get('value-bets')
@ApiOperation({ summary: 'Get value betting opportunities (EV+)' })
@Get("value-bets")
@ApiOperation({ summary: "Get value betting opportunities (EV+)" })
@ApiResponse({ status: 200, type: [ValueBetDto] })
async getValueBets(): Promise<ValueBetDto[]> {
return this.predictionsService.getValueBets();
@@ -76,8 +76,8 @@ export class PredictionsController {
* GET /predictions/history
* Get prediction history and accuracy stats
*/
@Get('history')
@ApiOperation({ summary: 'Get prediction history and accuracy statistics' })
@Get("history")
@ApiOperation({ summary: "Get prediction history and accuracy statistics" })
@ApiResponse({ status: 200, type: PredictionHistoryResponseDto })
async getHistory(): Promise<PredictionHistoryResponseDto> {
return this.predictionsService.getPredictionHistory();
@@ -87,14 +87,14 @@ export class PredictionsController {
* GET /predictions/:matchId
* Get prediction for a specific match
*/
@Get(':matchId')
@Get(":matchId")
@Public()
@ApiOperation({ summary: 'Get prediction for a specific match' })
@ApiParam({ name: 'matchId', description: 'Match ID' })
@ApiOperation({ summary: "Get prediction for a specific match" })
@ApiParam({ name: "matchId", description: "Match ID" })
@ApiResponse({ status: 200, type: MatchPredictionDto })
@ApiResponse({ status: 404, description: 'Match not found' })
@ApiResponse({ status: 404, description: "Match not found" })
async getPrediction(
@Param('matchId') matchId: string,
@Param("matchId") matchId: string,
): Promise<MatchPredictionDto> {
// Check cache first
const cached = await this.predictionsService.getCachedPrediction(matchId);
@@ -119,9 +119,9 @@ export class PredictionsController {
* POST /predictions/generate
* Generate prediction with provided match data
*/
@Post('generate')
@Post("generate")
@HttpCode(HttpStatus.OK)
@ApiOperation({ summary: 'Generate prediction with provided match data' })
@ApiOperation({ summary: "Generate prediction with provided match data" })
@ApiResponse({ status: 200, type: MatchPredictionDto })
async generatePrediction(
@Body() dto: GeneratePredictionDto,
@@ -131,7 +131,7 @@ export class PredictionsController {
});
if (!prediction) {
throw new NotFoundException('Failed to generate prediction');
throw new NotFoundException("Failed to generate prediction");
}
return prediction;
@@ -141,19 +141,19 @@ export class PredictionsController {
* POST /predictions/smart-coupon
* Generate Smart Coupon using AI Engine V20
*/
@Post('smart-coupon')
@Post("smart-coupon")
@HttpCode(HttpStatus.OK)
@ApiOperation({
summary: 'Generate Smart Coupon with V20 AI recommendations',
summary: "Generate Smart Coupon with V20 AI recommendations",
})
@ApiResponse({
status: 200,
description: 'Smart coupon generated successfully',
description: "Smart coupon generated successfully",
})
async generateSmartCoupon(@Body() dto: SmartCouponRequestDto): Promise<any> {
const coupon = await this.predictionsService.getSmartCoupon(
dto.matchIds,
dto.strategy || 'BALANCED',
dto.strategy || "BALANCED",
{
maxMatches: dto.maxMatches,
minConfidence: dto.minConfidence,
@@ -161,7 +161,7 @@ export class PredictionsController {
);
if (!coupon) {
throw new NotFoundException('Failed to generate Smart Coupon');
throw new NotFoundException("Failed to generate Smart Coupon");
}
return coupon;