Merge branch 'develop' into develop-Bright

# Conflicts:
#	src/controllers/ImportDataController.ts
This commit is contained in:
Bright 2024-07-25 16:22:29 +07:00
commit 022cc04e7b
13 changed files with 300 additions and 133 deletions

View file

@ -434,33 +434,33 @@ export class ImportDataController extends Controller {
return new HttpSuccess(result);
}
// /**
// * @summary Import Education Code
// */
// @Post("uploadEducation-Code")
// @UseInterceptors(FileInterceptor("file"))
// async UploadFileSQLEducationCode(
// @UploadedFile() file: Express.Multer.File,
// @Request() request: { user: Record<string, any> },
// ) {
// const workbook = xlsx.read(file.buffer, { type: "buffer" });
// const sheetName = workbook.SheetNames[0]
// const sheet = workbook.Sheets[sheetName];
// const getExcel = xlsx.utils.sheet_to_json(sheet);
// let educationMis_: any = [];
/**
* @summary Import Education Code
*/
@Post("uploadEducation-Code")
@UseInterceptors(FileInterceptor("file"))
async UploadFileSQLEducationCode(
@UploadedFile() file: Express.Multer.File,
@Request() request: { user: Record<string, any> },
) {
const workbook = xlsx.read(file.buffer, { type: "buffer" });
const sheetName = workbook.SheetNames[0]
const sheet = workbook.Sheets[sheetName];
const getExcel = xlsx.utils.sheet_to_json(sheet);
let educationMis_: any = [];
await Promise.all(
getExcel.map(async (item: any) => {
const educationMis = new EducationMis();
educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
educationMis_.push(educationMis);
// await Promise.all(
// getExcel.map(async (item: any) => {
// const educationMis = new EducationMis();
// educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
// educationMis.EDUCATION_CODE = item.EDUCATION_CODE;
// educationMis_.push(educationMis);
// }),
// );
// await this.educationMisRepo.save(educationMis_);
// return new HttpSuccess(educationMis_);
// }
}),
);
await this.educationMisRepo.save(educationMis_);
return new HttpSuccess(educationMis_);
}
// /**
// * API upload EDU