|
@@ -282,22 +282,21 @@ export class VideoMediaController {
|
|
|
schema: {
|
|
schema: {
|
|
|
type: 'object',
|
|
type: 'object',
|
|
|
properties: {
|
|
properties: {
|
|
|
- file: {
|
|
|
|
|
- type: 'string',
|
|
|
|
|
- format: 'binary',
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ file: { type: 'string', format: 'binary' },
|
|
|
},
|
|
},
|
|
|
required: ['file'],
|
|
required: ['file'],
|
|
|
},
|
|
},
|
|
|
})
|
|
})
|
|
|
@Post('import/excel-tags')
|
|
@Post('import/excel-tags')
|
|
|
- @UseInterceptors(FileInterceptor('file', { storage: multer.memoryStorage() }))
|
|
|
|
|
- async importExcelTags(@UploadedFile() file: Express.Multer.File) {
|
|
|
|
|
- if (!file) {
|
|
|
|
|
- throw new BadRequestException('No file uploaded');
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ async importExcelTags(@Req() req: FastifyRequest) {
|
|
|
|
|
+ // fastify multipart
|
|
|
|
|
+ const part = await (req as any).file();
|
|
|
|
|
+ if (!part) throw new BadRequestException('No file uploaded');
|
|
|
|
|
+
|
|
|
|
|
+ const buf = await part.toBuffer();
|
|
|
|
|
+ if (!buf?.length) throw new BadRequestException('Empty file');
|
|
|
|
|
|
|
|
- return this.videoMediaService.importExcelTags(file);
|
|
|
|
|
|
|
+ return this.videoMediaService.importExcelTags(buf);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|