This commit is contained in:
@@ -28,7 +28,11 @@ export class LeaguesController {
|
||||
@Get("countries")
|
||||
@Public()
|
||||
@ApiOperation({ summary: "Get all countries" })
|
||||
@ApiResponse({ status: 200, description: "List of countries" })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "List of countries",
|
||||
schema: { type: "array", items: { type: "object" } },
|
||||
})
|
||||
async getCountries() {
|
||||
return this.leaguesService.findAllCountries();
|
||||
}
|
||||
@@ -40,6 +44,11 @@ export class LeaguesController {
|
||||
@Get("countries/:id")
|
||||
@Public()
|
||||
@ApiOperation({ summary: "Get country by ID with leagues" })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Country details",
|
||||
schema: { type: "object" },
|
||||
})
|
||||
@ApiParam({ name: "id", description: "Country ID" })
|
||||
async getCountryById(@Param("id") id: string) {
|
||||
const country = await this.leaguesService.findCountryById(id);
|
||||
@@ -54,6 +63,11 @@ export class LeaguesController {
|
||||
@Get()
|
||||
@Public()
|
||||
@ApiOperation({ summary: "Get all leagues" })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "List of leagues",
|
||||
schema: { type: "array", items: { type: "object" } },
|
||||
})
|
||||
@ApiQuery({
|
||||
name: "sport",
|
||||
required: false,
|
||||
@@ -71,6 +85,11 @@ export class LeaguesController {
|
||||
@Get("teams/h2h")
|
||||
@Public()
|
||||
@ApiOperation({ summary: "Get head-to-head matches between two teams" })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Head-to-head matches",
|
||||
schema: { type: "array", items: { type: "object" } },
|
||||
})
|
||||
@ApiQuery({ name: "team1", required: true })
|
||||
@ApiQuery({ name: "team2", required: true })
|
||||
@ApiQuery({ name: "limit", required: false, type: Number })
|
||||
@@ -93,6 +112,11 @@ export class LeaguesController {
|
||||
@Get("teams/search")
|
||||
@Public()
|
||||
@ApiOperation({ summary: "Search teams by name" })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "List of teams matching search",
|
||||
schema: { type: "array", items: { type: "object" } },
|
||||
})
|
||||
@ApiQuery({ name: "q", required: true, description: "Search query" })
|
||||
@ApiQuery({
|
||||
name: "sport",
|
||||
@@ -110,6 +134,11 @@ export class LeaguesController {
|
||||
@Get("teams/:id")
|
||||
@Public()
|
||||
@ApiOperation({ summary: "Get team by ID" })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Team details",
|
||||
schema: { type: "object" },
|
||||
})
|
||||
@ApiParam({ name: "id", description: "Team ID" })
|
||||
async getTeamById(@Param("id") id: string) {
|
||||
const team = await this.leaguesService.findTeamById(id);
|
||||
@@ -124,6 +153,17 @@ export class LeaguesController {
|
||||
@Get("teams/:id/matches")
|
||||
@Public()
|
||||
@ApiOperation({ summary: "Get team's recent matches (paginated)" })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "Paginated list of matches",
|
||||
schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
data: { type: "array", items: { type: "object" } },
|
||||
meta: { type: "object" },
|
||||
},
|
||||
},
|
||||
})
|
||||
@ApiParam({ name: "id", description: "Team ID" })
|
||||
@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)" })
|
||||
@@ -149,6 +189,11 @@ export class LeaguesController {
|
||||
@Get(":id")
|
||||
@Public()
|
||||
@ApiOperation({ summary: "Get league by ID" })
|
||||
@ApiResponse({
|
||||
status: 200,
|
||||
description: "League details",
|
||||
schema: { type: "object" },
|
||||
})
|
||||
@ApiParam({ name: "id", description: "League ID" })
|
||||
async getLeagueById(@Param("id") id: string) {
|
||||
const league = await this.leaguesService.findLeagueById(id);
|
||||
|
||||
Reference in New Issue
Block a user