Vizzuality/landgriffon

View on GitHub
api/src/decorators/xlsx-upload.decorator.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { applyDecorators } from '@nestjs/common';
import {
  ApiBody,
  ApiConsumes,
  ApiCreatedResponse,
  ApiOperation,
} from '@nestjs/swagger';

export function ApiConsumesXLSX(): any {
  return applyDecorators(
    ApiOperation({
      description: 'Upload XLSX dataset',
    }),
    ApiConsumes('multipart/form-data'),
    ApiBody({
      schema: {
        type: 'object',
        properties: {
          file: {
            type: 'XLSX File',
            format: 'binary',
          },
        },
      },
    }),
    ApiCreatedResponse(),
  );
}