File

src/highlight/highlight.controller.ts

Prefix

highlights

Index

Methods

Methods

Async findAllFeaturedHighlights
findAllFeaturedHighlights(pageOptionsDto: HighlightOptionsDto)
Decorators :
@Get('/featured')
@ApiOperation({operationId: 'findAllFeaturedHighlights', summary: 'Finds all featured highlights and paginates them'})
@ApiPaginatedResponse(DbUserHighlight)
@ApiOkResponse({type: DbUserHighlight})
Parameters :
Name Type Optional
pageOptionsDto HighlightOptionsDto No
Async findAllHighlightRepos
findAllHighlightRepos(pageOptionsDto: PageOptionsDto)
Decorators :
@Get('/repos/list')
@ApiOperation({operationId: 'findAllHighlightRepos', summary: 'Finds all highlight repos and paginates them'})
@ApiPaginatedResponse(DbUserHighlightRepo)
@ApiOkResponse({type: DbUserHighlightRepo})
Parameters :
Name Type Optional
pageOptionsDto PageOptionsDto No
Async findAllHighlights
findAllHighlights(pageOptionsDto: HighlightOptionsDto)
Decorators :
@Get('/list')
@ApiOperation({operationId: 'findAllHighlights', summary: 'Finds all highlights and paginates them'})
@ApiPaginatedResponse(DbUserHighlight)
@ApiOkResponse({type: DbUserHighlight})
Parameters :
Name Type Optional
pageOptionsDto HighlightOptionsDto No
Async findTopHighlights
findTopHighlights(pageOptionsDto: PageOptionsDto)
Decorators :
@Get('/top')
@ApiOperation({operationId: 'findTopHighlights', summary: 'Finds top highlights for the day range and paginates them'})
@ApiPaginatedResponse(DbUserHighlight)
@ApiOkResponse({type: DbUserHighlight})
Parameters :
Name Type Optional
pageOptionsDto PageOptionsDto No
Async getAllHighlightReactions
getAllHighlightReactions(id: number)
Decorators :
@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'})
Parameters :
Name Type Optional
id number No
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);
  }
}

results matching ""

    No results matching ""