fix: update version tags to v28 and temporarily disable cache for predictions
This commit is contained in:
@@ -105,12 +105,34 @@ export class LeaguesService {
|
||||
teamId: string,
|
||||
page: number = 1,
|
||||
limit: number = 20,
|
||||
season?: string
|
||||
) {
|
||||
const skip = (page - 1) * limit;
|
||||
const where = {
|
||||
const where: any = {
|
||||
OR: [{ homeTeamId: teamId }, { awayTeamId: teamId }],
|
||||
};
|
||||
|
||||
if (season) {
|
||||
// season format expected: "2024-2025"
|
||||
const parts = season.split("-");
|
||||
if (parts.length === 2) {
|
||||
const startYear = parseInt(parts[0], 10);
|
||||
const endYear = parseInt(parts[1], 10);
|
||||
|
||||
if (!isNaN(startYear) && !isNaN(endYear)) {
|
||||
// Season starts August 1st of startYear
|
||||
const startDate = new Date(Date.UTC(startYear, 7, 1)).getTime();
|
||||
// Season ends July 31st of endYear
|
||||
const endDate = new Date(Date.UTC(endYear, 6, 31, 23, 59, 59, 999)).getTime();
|
||||
|
||||
where.mstUtc = {
|
||||
gte: startDate,
|
||||
lte: endDate,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const [data, total] = await this.prisma.$transaction([
|
||||
this.prisma.match.findMany({
|
||||
where,
|
||||
@@ -127,7 +149,26 @@ export class LeaguesService {
|
||||
]);
|
||||
|
||||
return {
|
||||
data,
|
||||
data: data.map((m) => ({
|
||||
id: m.id,
|
||||
matchName: m.matchName,
|
||||
matchSlug: m.matchSlug,
|
||||
mstUtc: Number(m.mstUtc),
|
||||
scoreHome: m.scoreHome,
|
||||
scoreAway: m.scoreAway,
|
||||
status: m.status,
|
||||
state: m.state,
|
||||
homeTeamName: m.homeTeam?.name,
|
||||
homeTeamLogo: m.homeTeamId
|
||||
? `https://file.mackolikfeeds.com/teams/${m.homeTeamId}`
|
||||
: null,
|
||||
awayTeamName: m.awayTeam?.name,
|
||||
awayTeamLogo: m.awayTeamId
|
||||
? `https://file.mackolikfeeds.com/teams/${m.awayTeamId}`
|
||||
: null,
|
||||
leagueName: m.league?.name,
|
||||
countryName: m.league?.country?.name,
|
||||
})),
|
||||
total,
|
||||
page,
|
||||
limit,
|
||||
|
||||
Reference in New Issue
Block a user