How to use the @nestjs/swagger.ApiImplicitQuery function in @nestjs/swagger

To help you get started, we’ve selected a few @nestjs/swagger examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FunnyLiu / nestDemo / serve-data / src / product / product.controller.ts View on Github external
@ApiBearerAuth()
@ApiUseTags('products')
@Controller('products')
export class ProductController {

  constructor(
    private readonly productService: ProductService,
    // private readonly redisService: RedisService
  ) {}


  private readonly logger = new Logger(ProductController.name)

  @ApiOperation({ title: 'Get all products' })
  @ApiImplicitQuery({ name:'name', type: 'string', description:'product name',required: false})
  @ApiResponse({ status: 200, description: 'Return all products.'})
  @Get()
  async findAll(@Query() query): Promise {
    //use redis
    // await this.redisService.set('foo','hehe')
    // console.log(await this.redisService.get('foo'))
    return await this.productService.findAll(query);
  }

  @ApiOperation({ title: 'Create product' })
  @ApiResponse({ status: 201, description: 'The product has been successfully created.'})
  @ApiResponse({ status: 403, description: 'Forbidden.' })
  @UsePipes(new ValidationPipe({whitelist: true,forbidNonWhitelisted: true }))
  @Post()
  async create(@Body() productData:CreateProductDto) {
    return this.productService.create(productData)
github nayutaco / ptarmigan / ptarmapi / src / ptarmigan / ptarmigan.controller.ts View on Github external
@Post('disconnect') // disconnect -> disconnectpeer
    async executeDisconnect(@Body() dto: PeerNodeDto) {
        return await this.ptarmiganService.requestTCP('disconnect', [dto.peerNodeId, '0.0.0.0', 0]);
    }

    @ApiBearerAuth()
    @UseGuards(AuthGuard())
    @Post('getlasterror') // getlasterror -> getlasterror
    async executeGetLastErrort(@Body() dto: PeerNodeDto) {
        return await this.ptarmiganService.requestTCP('getlasterror', [dto.peerNodeId, '0.0.0.0', 0]);
    }

    @ApiBearerAuth()
    @UseGuards(AuthGuard())
    @Post('dev-disautoconn') // disautoconn -> dev-disableautoconnect
    @ApiImplicitQuery({
        name: 'enable',
        enum: [0, 1],
    })
    async executeDisAutoConn(@Query('enable') enable: number) {
        return await this.ptarmiganService.requestTCP('disautoconn', [enable.toString(10)]);
    }

    @ApiBearerAuth()
    @UseGuards(AuthGuard())
    @Post('dev-listtransactions') // getcommittx -> dev-listtransactions
    async executeGetCommitTx(@Body() dto: PeerNodeDto) {
        return await this.ptarmiganService.requestTCP('getcommittx', [dto.peerNodeId, '0.0.0.0', 0]);
    }

    // ------------------------------------------------------------------------------
    // channel
github EndyKaufman / nest-permissions-seed / src / libs / core / controllers / content-types.controller.ts View on Github external
let object = await this.contentTypeRepository.findOneOrFail(id);
            return plainToClass(OutContentTypeDto, object);
        } catch (error) {
            throw error;
        }
    }
    @Roles('isSuperuser')
    @Permissions('read_content-type')
    @HttpCode(HttpStatus.OK)
    @ApiResponse({
        status: HttpStatus.OK, type: OutContentTypesDto,
        description: ''
    })
    @ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
    @ApiImplicitQuery({ name: 'q', required: false, type: String, description: 'Text for search (default: empty)' })
    @ApiImplicitQuery({
        name: 'per_page', required: false, type: Number,
        description: 'Number of results to return per page. (default: 10)'
    })
    @ApiImplicitQuery({
        name: 'cur_page', required: false, type: Number,
        description: 'A page number within the paginated result set. (default: 1)'
    })
    @Get()
    async loadAll(
        @Query('cur_page', new ParseIntWithDefaultPipe(1)) curPage,
        @Query('per_page', new ParseIntWithDefaultPipe(10)) perPage,
        @Query('q') q
        ) {
        try {
            const objects = await this.contentTypeRepository.findAndCount({
                skip: (curPage - 1) * perPage,
github rucken / todo-nestjs / src / libs / core / controllers / users.controller.ts View on Github external
description: ''
  })
  @ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
  @ApiImplicitQuery({
    name: 'q',
    required: false,
    type: String,
    description: 'Text for search (default: empty)'
  })
  @ApiImplicitQuery({
    name: 'sort',
    required: false,
    type: String,
    description: 'Column name for sort (default: -id)'
  })
  @ApiImplicitQuery({
    name: 'per_page',
    required: false,
    type: Number,
    description: 'Number of results to return per page. (default: 10)'
  })
  @ApiImplicitQuery({
    name: 'cur_page',
    required: false,
    type: Number,
    description: 'A page number within the paginated result set. (default: 1)'
  })
  @ApiImplicitQuery({
    name: 'group',
    required: false,
    type: Number,
    description: 'Group id for filter data by group. (default: empty)'
github rucken / core-nestjs / libs / rucken / core-nestjs / src / controllers / groups.controller.ts View on Github external
);
    } catch (error) {
      throw error;
    }
  }

  @Roles('isSuperuser')
  @Permissions('read_group')
  @HttpCode(HttpStatus.OK)
  @ApiResponse({
    status: HttpStatus.OK,
    type: OutGroupsDto,
    description: ''
  })
  @ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
  @ApiImplicitQuery({
    name: 'q',
    required: false,
    type: String,
    description: 'Text for search (default: empty)'
  })
  @ApiImplicitQuery({
    name: 'sort',
    required: false,
    type: String,
    description: 'Column name for sort (default: -id)'
  })
  @ApiImplicitQuery({
    name: 'per_page',
    required: false,
    type: Number,
    description: 'Number of results to return per page. (default: 10)'
github rucken / todo-nestjs / src / libs / core / controllers / permissions.controller.ts View on Github external
description: ''
  })
  @ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
  @ApiImplicitQuery({
    name: 'q',
    required: false,
    type: String,
    description: 'Text for search (default: empty)'
  })
  @ApiImplicitQuery({
    name: 'sort',
    required: false,
    type: String,
    description: 'Column name for sort (default: -id)'
  })
  @ApiImplicitQuery({
    name: 'per_page',
    required: false,
    type: Number,
    description: 'Number of results to return per page. (default: 10)'
  })
  @ApiImplicitQuery({
    name: 'cur_page',
    required: false,
    type: Number,
    description: 'A page number within the paginated result set. (default: 1)'
  })
  @ApiImplicitQuery({
    name: 'group',
    required: false,
    type: Number,
    description: 'Group id for filter data by group. (default: empty)'
github rucken / todo-nestjs / libs / rucken / todo-nestjs / src / controllers / tasks.controller.ts View on Github external
description: ''
  })
  @ApiResponse({ status: HttpStatus.FORBIDDEN, description: 'Forbidden.' })
  @ApiImplicitQuery({
    name: 'q',
    required: false,
    type: String,
    description: 'Text for search (default: empty)'
  })
  @ApiImplicitQuery({
    name: 'sort',
    required: false,
    type: String,
    description: 'Column name for sort (default: -id)'
  })
  @ApiImplicitQuery({
    name: 'per_page',
    required: false,
    type: Number,
    description: 'Number of results to return per page. (default: 10)'
  })
  @ApiImplicitQuery({
    name: 'cur_page',
    required: false,
    type: Number,
    description: 'A page number within the paginated result set. (default: 1)'
  })
  @ApiImplicitQuery({
    name: 'project',
    required: false,
    type: Number,
    description: 'Project id for filter data by project. (default: empty)'