This commit is contained in:
2026-04-23 22:22:59 +03:00
parent df428ed1e8
commit 634204acf0
6 changed files with 2064 additions and 90 deletions
+7 -4
View File
@@ -119,20 +119,23 @@ export class LeaguesController {
/**
* GET /leagues/teams/:id/matches
* Get team's recent matches
* Get team's recent matches (paginated)
*/
@Get("teams/:id/matches")
@Public()
@ApiOperation({ summary: "Get team's recent matches" })
@ApiOperation({ summary: "Get team's recent matches (paginated)" })
@ApiParam({ name: "id", description: "Team ID" })
@ApiQuery({ name: "limit", required: false, type: Number })
@ApiQuery({ name: "page", required: false, type: Number, description: "Page number (default: 1)" })
@ApiQuery({ name: "limit", required: false, type: Number, description: "Items per page (default: 20)" })
async getTeamMatches(
@Param("id") id: string,
@Query("page") page?: string,
@Query("limit") limit?: string,
) {
return this.leaguesService.getTeamRecentMatches(
id,
parseInt(limit || "10", 10),
parseInt(page || "1", 10),
parseInt(limit || "20", 10),
);
}
+33 -14
View File
@@ -99,21 +99,40 @@ export class LeaguesService {
}
/**
* Get team's matches (past + upcoming)
* Get team's matches (past + upcoming) with pagination
*/
async getTeamRecentMatches(teamId: string, limit: number = 50) {
return this.prisma.match.findMany({
where: {
OR: [{ homeTeamId: teamId }, { awayTeamId: teamId }],
},
include: {
homeTeam: true,
awayTeam: true,
league: { include: { country: true } },
},
orderBy: { mstUtc: "desc" },
take: limit,
});
async getTeamRecentMatches(
teamId: string,
page: number = 1,
limit: number = 20,
) {
const skip = (page - 1) * limit;
const where = {
OR: [{ homeTeamId: teamId }, { awayTeamId: teamId }],
};
const [data, total] = await this.prisma.$transaction([
this.prisma.match.findMany({
where,
include: {
homeTeam: true,
awayTeam: true,
league: { include: { country: true } },
},
orderBy: { mstUtc: "desc" },
skip,
take: limit,
}),
this.prisma.match.count({ where }),
]);
return {
data,
total,
page,
limit,
totalPages: Math.ceil(total / limit),
};
}
/**
+8
View File
@@ -418,6 +418,14 @@ export class MatchPredictionDto {
@ApiProperty({ type: Object, required: false })
surprise_hunter?: Record<string, unknown>;
@ApiProperty({
type: Object,
required: false,
description:
"V28 Odds-Band engine output: historical band analytics, triple-value detection, cards profiling, and HTFT 9-combo analysis",
})
v27_engine?: Record<string, unknown>;
}
export class ValueBetDto {