src/highlight/highlight.controller.ts
highlights
Methods |
|
Async findAllFeaturedHighlights | ||||||
findAllFeaturedHighlights(pageOptionsDto: HighlightOptionsDto)
|
||||||
Decorators :
@Get('/featured')
|
||||||
Defined in src/highlight/highlight.controller.ts:43
|
||||||
Parameters :
Returns :
Promise<PageDto<DbUserHighlight>>
|
Async findAllHighlightRepos | ||||||
findAllHighlightRepos(pageOptionsDto: PageOptionsDto)
|
||||||
Decorators :
@Get('/repos/list')
|
||||||
Defined in src/highlight/highlight.controller.ts:54
|
||||||
Parameters :
Returns :
Promise<PageDto<DbUserHighlightRepo>>
|
Async findAllHighlights | ||||||
findAllHighlights(pageOptionsDto: HighlightOptionsDto)
|
||||||
Decorators :
@Get('/list')
|
||||||
Defined in src/highlight/highlight.controller.ts:32
|
||||||
Parameters :
Returns :
Promise<PageDto<DbUserHighlight>>
|
Async findTopHighlights | ||||||
findTopHighlights(pageOptionsDto: PageOptionsDto)
|
||||||
Decorators :
@Get('/top')
|
||||||
Defined in src/highlight/highlight.controller.ts:78
|
||||||
Parameters :
Returns :
Promise<PageDto<DbUserHighlight>>
|
Async getAllHighlightReactions | ||||||
getAllHighlightReactions(id: number)
|
||||||
Decorators :
@Get('/:id/reactions')
|
||||||
Defined in src/highlight/highlight.controller.ts:67
|
||||||
Parameters :
|
import { Controller, Get, Param, ParseIntPipe, Query } from "@nestjs/common";
import {
ApiOperation,
ApiOkResponse,
ApiTags,
ApiBadRequestResponse,
ApiNotFoundResponse,
ApiParam,
} from "@nestjs/swagger";
import { ApiPaginatedResponse } from "../common/decorators/api-paginated-response.decorator";
import { PageOptionsDto } from "../common/dtos/page-options.dto";
import { PageDto } from "../common/dtos/page.dto";
import { DbUserHighlight } from "../user/entities/user-highlight.entity";
import { UserHighlightsService } from "../user/user-highlights.service";
import { DbUserHighlightRepo } from "./entities/user-highlight-repo.entity";
import { DbUserHighlightReactionResponse, HighlightOptionsDto } from "./dtos/highlight-options.dto";
@Controller("highlights")
@ApiTags("Highlights service")
export class HighlightController {
constructor(private readonly userHighlightsService: UserHighlightsService) {}
@Get("/list")
@ApiOperation({
operationId: "findAllHighlights",
summary: "Finds all highlights and paginates them",
})
@ApiPaginatedResponse(DbUserHighlight)
@ApiOkResponse({ type: DbUserHighlight })
async findAllHighlights(@Query() pageOptionsDto: HighlightOptionsDto): Promise<PageDto<DbUserHighlight>> {
return this.userHighlightsService.findAll(pageOptionsDto);
}
@Get("/featured")
@ApiOperation({
operationId: "findAllFeaturedHighlights",
summary: "Finds all featured highlights and paginates them",
})
@ApiPaginatedResponse(DbUserHighlight)
@ApiOkResponse({ type: DbUserHighlight })
async findAllFeaturedHighlights(@Query() pageOptionsDto: HighlightOptionsDto): Promise<PageDto<DbUserHighlight>> {
return this.userHighlightsService.findAllFeatured(pageOptionsDto);
}
@Get("/repos/list")
@ApiOperation({
operationId: "findAllHighlightRepos",
summary: "Finds all highlight repos and paginates them",
})
@ApiPaginatedResponse(DbUserHighlightRepo)
@ApiOkResponse({ type: DbUserHighlightRepo })
async findAllHighlightRepos(@Query() pageOptionsDto: PageOptionsDto): Promise<PageDto<DbUserHighlightRepo>> {
return this.userHighlightsService.findAllHighlightRepos(pageOptionsDto);
}
@Get("/:id/reactions")
@ApiOperation({
operationId: "getAllHighlightReactions",
summary: "Retrieves total reactions for a highlight",
})
@ApiOkResponse({ type: DbUserHighlightReactionResponse })
@ApiNotFoundResponse({ description: "Unable to get user highlight reactions" })
@ApiBadRequestResponse({ description: "Invalid request" })
@ApiParam({ name: "id", type: "integer" })
async getAllHighlightReactions(@Param("id", ParseIntPipe) id: number): Promise<DbUserHighlightReactionResponse[]> {
return this.userHighlightsService.findAllHighlightReactions(id);
}
@Get("/top")
@ApiOperation({
operationId: "findTopHighlights",
summary: "Finds top highlights for the day range and paginates them",
})
@ApiPaginatedResponse(DbUserHighlight)
@ApiOkResponse({ type: DbUserHighlight })
async findTopHighlights(@Query() pageOptionsDto: PageOptionsDto): Promise<PageDto<DbUserHighlight>> {
return this.userHighlightsService.findTop(pageOptionsDto);
}
}