From e13776f78a4081da3994a33480b98a6f40b67791 Mon Sep 17 00:00:00 2001 From: AnandaTon Date: Thu, 25 Jul 2024 11:25:12 +0700 Subject: [PATCH] Update ImportDataController.ts --- src/controllers/ImportDataController.ts | 72 +------------------------ 1 file changed, 1 insertion(+), 71 deletions(-) diff --git a/src/controllers/ImportDataController.ts b/src/controllers/ImportDataController.ts index 6120155c..6681d11f 100644 --- a/src/controllers/ImportDataController.ts +++ b/src/controllers/ImportDataController.ts @@ -656,7 +656,7 @@ export class ImportDataController extends Controller { } @Get("uploadSQLStatic") - async uploadFileSQLStati() { + async uploadFileSQLStatic() { const filePath = path.resolve(__dirname, "backup-employee-temp-bmaStatic.xlsx"); // Corrected file path console.log(filePath); @@ -674,76 +674,6 @@ export class ImportDataController extends Controller { // Create a new Profile entity and assign fields from the parsed data const profile = new ProfileEmployee(); - // Check if the profile already exists - // const existingProfile = await this.profileEmpRepo.findOne({ - // where: { id: item["id"] }, - // }); - // If profile exists, skip saving - // if (existingProfile) { - // return; - // } - // Assign fields from the item to the profile entity - profile.id = item["id"]; - // profile.createdAt = item["createdUserId"] == "NULL" ? null : new Date(item["createdAt"]); - profile.createdUserId = item["createdUserId"] == "NULL" ? null : item["createdUserId"]; - // profile.lastUpdatedAt = item["createdUserId"] == "NULL" ? null : new Date(item["lastUpdatedAt"]); - profile.lastUpdateUserId = - item["lastUpdateUserId"] == "NULL" ? null : item["lastUpdateUserId"]; - profile.createdFullName = - item["createdFullName"] == "NULL" ? null : item["createdFullName"]; - profile.lastUpdateFullName = - item["lastUpdateFullName"] == "NULL" ? null : item["lastUpdateFullName"]; - profile.prefix = item["prefix"] == "NULL" ? null : item["prefix"]; - profile.firstName = item["firstName"] == "NULL" ? null : item["firstName"]; - profile.lastName = item["lastName"] == "NULL" ? null : item["lastName"]; - profile.citizenId = item["citizenId"] == "NULL" ? null : item["citizenId"]; - profile.position = item["position"] == "NULL" ? null : item["position"]; - profile.posLevelId = item["posLevelId"] == "NULL" ? null : item["posLevelId"]; - profile.posTypeId = item["posTypeId"] == "NULL" ? null : item["posTypeId"]; - profile.email = item["email"] == "NULL" ? null : item["email"]; - profile.phone = item["phone"] == "NULL" ? null : item["phone"]; - profile.keycloak = item["keycloak"] == "NULL" ? null : item["keycloak"]; - profile.isProbation = item["isProbation"] == "NULL" ? null : item["isProbation"]; - // profile.dateRetire = item["dateRetire"] == "NULL" ? null : new Date(item["dateRetire"]); - // profile.birthDate = item["birthDate"] == "NULL" ? null : new Date(item["birthDate"]); - profile.salaryLevel = item["salaryLevel"] == "NULL" ? null : item["salaryLevel"]; - profile.ethnicity = item["ethnicity"] == "NULL" ? null : item["ethnicity"]; - profile.telephoneNumber = - item["telephoneNumber"] == "NULL" ? null : item["telephoneNumber"]; - profile.group = item["group"] == "NULL" ? null : item["group"]; - profile.gender = item["gender"] == "NULL" ? null : item["gender"]; - profile.relationship = item["relationship"] == "NULL" ? null : item["relationship"]; - profile.religion = item["religion"] == "NULL" ? null : item["religion"]; - profile.bloodGroup = item["bloodGroup"] == "NULL" ? null : item["bloodGroup"]; - profile.rank = item["rank"] == "NULL" ? null : item["rank"]; - profile.employeeClass = item["employeeClass"] == "NULL" ? null : item["employeeClass"]; - profile.avatar = item["avatar"] == "NULL" ? null : item["avatar"]; - // profile.dateRetireLaw = item["dateRetireLaw"] == "NULL" ? null : new Date(item["dateRetireLaw"]); - profile.registrationAddress = - item["registrationAddress"] == "NULL" ? null : item["registrationAddress"]; - profile.registrationProvinceId = - item["registrationProvinceId"] == "NULL" ? null : item["registrationProvinceId"]; - profile.registrationDistrictId = - item["registrationDistrictId"] == "NULL" ? null : item["registrationDistrictId"]; - profile.registrationSubDistrictId = - item["registrationSubDistrictId"] == "NULL" ? null : item["registrationSubDistrictId"]; - profile.registrationZipCode = - item["registrationZipCode"] == "NULL" ? null : item["registrationZipCode"]; - profile.currentAddress = item["currentAddress"] == "NULL" ? null : item["currentAddress"]; - profile.currentProvinceId = - item["currentProvinceId"] == "NULL" ? null : item["currentProvinceId"]; - profile.currentDistrictId = - item["currentDistrictId"] == "NULL" ? null : item["currentDistrictId"]; - profile.currentSubDistrictId = - item["currentSubDistrictId"] == "NULL" ? null : item["currentSubDistrictId"]; - profile.currentZipCode = item["currentZipCode"] == "NULL" ? null : item["currentZipCode"]; - profile.avatarName = item["avatarName"] == "NULL" ? null : item["avatarName"]; - profile.nationality = item["nationality"] == "NULL" ? null : item["nationality"]; - // profile.dateAppoint = item["dateAppoint"] == "NULL" ? null : new Date(item["dateAppoint"]); - // profile.dateStart = item["dateStart"] == "NULL" ? null : new Date(item["dateStart"]); - profile.govAgeAbsent = item["govAgeAbsent"] == "NULL" ? null : item["govAgeAbsent"]; - profile.govAgePlus = item["govAgePlus"] == "NULL" ? null : item["govAgePlus"]; - profile.reasonSameDate = item["reasonSameDate"] == "NULL" ? null : item["reasonSameDate"]; // profiles.push(profile); }), );