samchon / nestia

NestJS Helper Libraries + TypeScript OpenAPI generator
https://nestia.io/
MIT License
1.85k stars 95 forks source link

Please make @TypedQuery accept query like a[]=1&a[]=2&a[]=3 #590

Closed saroro1 closed 1 year ago

saroro1 commented 1 year ago
@TypedRoute.Delete('/photo')
  async deletePhotos(
    @Req() req: USER_TYPE, //extends Request
    @TypedQuery() params: ExcelPhotoDeleteBody,
  ): Promise<ExcelPhotoResInterface> {
    console.log(req.query.files);
    console.log(params.files);
    if (params.files.length === 0) {
      throw new BadRequestError(ErrorMsg.BAD_REQUEST);
    }
    return await this.excelService.deletePhotos(req.user, params.files);
  }
export interface ExcelPhotoDeleteBody {
  /**
   * 파일 목록
   */
  files: string[];
}

After sending request like files[]=asdf1&files[]=asdf2 req.query.files can accept string[] but TypedQuery() doesn't.

Could you make @TypeQuery accept array like query?

image
samchon commented 1 year ago

Declare like a=1&a=2&a=3.

The variable[] is not standard.