@nestjs/common#ParseBoolPipe TypeScript Examples

The following examples show how to use @nestjs/common#ParseBoolPipe. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: time-series.controller.ts    From aqualink-app with MIT License 6 votes vote down vote up
@ApiTimeSeriesResponse()
  @ApiOperation({
    summary: 'Returns specified time series data for a specified site',
  })
  @ApiQuery({ name: 'start', example: '2021-05-18T10:20:28.017Z' })
  @ApiQuery({ name: 'end', example: '2021-05-18T10:20:28.017Z' })
  @ApiQuery({
    name: 'metrics',
    example: [Metric.BOTTOM_TEMPERATURE, Metric.TOP_TEMPERATURE],
  })
  @ApiQuery({ name: 'hourly', example: false, required: false })
  @Get('sites/:siteId')
  findSiteData(
    @Param() siteDataDto: SiteDataDto,
    @Query(
      'metrics',
      new DefaultValuePipe(Object.values(Metric)),
      ParseArrayPipe,
    )
    metrics: Metric[],
    @Query('start', ParseDatePipe) startDate?: string,
    @Query('end', ParseDatePipe) endDate?: string,
    @Query('hourly', ParseBoolPipe) hourly?: boolean,
  ) {
    return this.timeSeriesService.findSiteData(
      siteDataDto,
      metrics,
      startDate,
      endDate,
      hourly,
    );
  }
Example #2
Source File: time-series.controller.ts    From aqualink-app with MIT License 6 votes vote down vote up
@ApiOperation({ summary: 'Upload time series data' })
  @UseGuards(IsSiteAdminGuard)
  @Auth(AdminLevel.SiteManager, AdminLevel.SuperAdmin)
  @Post('sites/:siteId/site-survey-points/:surveyPointId/upload')
  @UseInterceptors(
    FilesInterceptor('files', MAX_FILE_COUNT, {
      dest: './upload',
      fileFilter,
      limits: {
        fileSize: MAX_FILE_SIZE_MB * 10 ** 6,
      },
    }),
  )
  uploadTimeSeriesData(
    @Param() surveyPointDataRangeDto: SurveyPointDataRangeDto,
    @UploadedFiles() files: Express.Multer.File[],
    @Body('sensor') sensor: SourceType,
    @Query('failOnWarning', ParseBoolPipe) failOnWarning?: boolean,
  ) {
    return this.timeSeriesService.uploadData(
      surveyPointDataRangeDto,
      sensor,
      files,
      failOnWarning,
    );
  }