no message

This commit is contained in:
AdisakKanthawilang 2024-06-06 11:20:37 +07:00
parent 9aada985a9
commit 8f7f8eaab6

View file

@ -23,8 +23,8 @@ import { FileInterceptor } from "@nestjs/platform-express";
import * as xlsx from "xlsx"; import * as xlsx from "xlsx";
import { ProfileEducation } from "../entities/ProfileEducation"; import { ProfileEducation } from "../entities/ProfileEducation";
@Route("api/v1/development/scholarship") @Route("api/v1/org/upload")
@Tags("DevelopmentScholarship") @Tags("UPLOAD")
@Security("bearerAuth") @Security("bearerAuth")
export class ImportDataController extends Controller { export class ImportDataController extends Controller {
private educationRepository = AppDataSource.getRepository(ProfileEducation); private educationRepository = AppDataSource.getRepository(ProfileEducation);
@ -34,14 +34,11 @@ export class ImportDataController extends Controller {
* @summary DEV_0 - upload EDU # * @summary DEV_0 - upload EDU #
* *
*/ */
@Post("upload") @Post("")
@UseInterceptors(FileInterceptor("file")) @UseInterceptors(FileInterceptor("file"))
async UploadUserDevelopemtById( async UploadUserDevelopemtById(@UploadedFile() file: Express.Multer.File) {
@UploadedFile() file: Express.Multer.File,
) {
const workbook = xlsx.read(file.buffer, { type: "buffer" }); const workbook = xlsx.read(file.buffer, { type: "buffer" });
const sheetName = workbook.SheetNames[1]; const sheetName = workbook.SheetNames[1];
const sheet = workbook.Sheets[sheetName]; const sheet = workbook.Sheets[sheetName];
const getEducations = xlsx.utils.sheet_to_json(sheet); const getEducations = xlsx.utils.sheet_to_json(sheet);