เพิ่ม id development

This commit is contained in:
kittapath 2024-08-27 17:30:19 +07:00
parent 70e1ab9efd
commit 9d232d1f26
7 changed files with 62 additions and 241 deletions

View file

@ -25,7 +25,6 @@ import {
UpdateProfileDevelopment,
} from "../entities/ProfileDevelopment";
import permission from "../interfaces/permission";
import { DevelopmentProject } from "../entities/developmentProject";
@Route("api/v1/org/profile/development")
@Tags("ProfileDevelopment")
@Security("bearerAuth")
@ -33,7 +32,6 @@ export class ProfileDevelopmentController extends Controller {
private profileRepository = AppDataSource.getRepository(Profile);
private developmentRepository = AppDataSource.getRepository(ProfileDevelopment);
private developmentHistoryRepository = AppDataSource.getRepository(ProfileDevelopmentHistory);
private developmentProjectRepository = AppDataSource.getRepository(DevelopmentProject);
@Get("user")
public async getDevelopmentUser(@Request() request: { user: Record<string, any> }) {
@ -43,23 +41,8 @@ export class ProfileDevelopmentController extends Controller {
}
const lists = await this.developmentRepository.find({
where: { profileId: profile.id },
relations: ["developmentProjects"],
});
const _lists = lists.map((item) => ({
id: item.id,
name: item.name,
target: item.target,
summary: item.summary,
point: item.point,
developmentProjects: item.developmentProjects.map((x) => x.name),
achievement10: item.achievement10,
achievement5: item.achievement5,
achievement0: item.achievement0,
isDevelopment70: item.isDevelopment70,
isDevelopment20: item.isDevelopment20,
isDevelopment10: item.isDevelopment10,
}));
return new HttpSuccess(_lists);
return new HttpSuccess(lists);
}
@Get("{profileId}")
@ -82,23 +65,8 @@ export class ProfileDevelopmentController extends Controller {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const lists = await this.developmentRepository.find({
where: { profileId: profileId },
relations: ["developmentProjects"],
});
const _lists = lists.map((item) => ({
id: item.id,
name: item.name,
target: item.target,
summary: item.summary,
point: item.point,
developmentProjects: item.developmentProjects.map((x) => x.name),
achievement10: item.achievement10,
achievement5: item.achievement5,
achievement0: item.achievement0,
isDevelopment70: item.isDevelopment70,
isDevelopment20: item.isDevelopment20,
isDevelopment10: item.isDevelopment10,
}));
return new HttpSuccess(_lists);
return new HttpSuccess(lists);
}
@Get("history/{developmentId}")
@ -127,24 +95,9 @@ export class ProfileDevelopmentController extends Controller {
}
const record = await this.developmentHistoryRepository.find({
where: { profileDevelopmentId: developmentId },
relations: ["developmentHistoryProjects"],
order: { createdAt: "DESC" },
});
const _lists = record.map((item) => ({
id: item.id,
name: item.name,
target: item.target,
summary: item.summary,
point: item.point,
developmentProjects: item.developmentHistoryProjects.map((x) => x.name),
achievement10: item.achievement10,
achievement5: item.achievement5,
achievement0: item.achievement0,
isDevelopment70: item.isDevelopment70,
isDevelopment20: item.isDevelopment20,
isDevelopment10: item.isDevelopment10,
}));
return new HttpSuccess(_lists);
return new HttpSuccess(record);
}
@Post()
@ -179,28 +132,6 @@ export class ProfileDevelopmentController extends Controller {
history.profileDevelopmentId = data.id;
await this.developmentHistoryRepository.save(history);
if (body.developmentProjects != null) {
await Promise.all(
body.developmentProjects.map(async (x) => {
let data1 = new DevelopmentProject();
data1.name = x;
data1.createdUserId = req.user.sub;
data1.createdFullName = req.user.name;
data1.lastUpdateUserId = req.user.sub;
data1.lastUpdateFullName = req.user.name;
data1.profileDevelopmentId = data.id;
await this.developmentProjectRepository.save(data1);
let data2 = new DevelopmentProject();
data2.name = x;
data2.createdUserId = req.user.sub;
data2.createdFullName = req.user.name;
data2.lastUpdateUserId = req.user.sub;
data2.lastUpdateFullName = req.user.name;
data2.profileDevelopmentId = data.id;
await this.developmentProjectRepository.save(data2);
}),
);
}
return new HttpSuccess();
}
@ -212,7 +143,6 @@ export class ProfileDevelopmentController extends Controller {
) {
const record = await this.developmentRepository.findOne({
where: { id: developmentId },
relations: ["developmentProjects"],
});
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", record.profileId);
@ -234,30 +164,6 @@ export class ProfileDevelopmentController extends Controller {
this.developmentRepository.save(record),
this.developmentHistoryRepository.save(history),
]);
await this.developmentProjectRepository.remove(record.developmentProjects);
if (body.developmentProjects != null) {
await Promise.all(
body.developmentProjects.map(async (x) => {
let data1 = new DevelopmentProject();
data1.name = x;
data1.createdUserId = req.user.sub;
data1.createdFullName = req.user.name;
data1.lastUpdateUserId = req.user.sub;
data1.lastUpdateFullName = req.user.name;
data1.profileDevelopmentId = record.id;
await this.developmentProjectRepository.save(data1);
let data2 = new DevelopmentProject();
data2.name = x;
data2.createdUserId = req.user.sub;
data2.createdFullName = req.user.name;
data2.lastUpdateUserId = req.user.sub;
data2.lastUpdateFullName = req.user.name;
data2.profileDevelopmentId = history.id;
await this.developmentProjectRepository.save(data2);
}),
);
}
return new HttpSuccess();
}
@ -272,10 +178,6 @@ export class ProfileDevelopmentController extends Controller {
_record.profileId,
);
}
await this.developmentProjectRepository.delete({ profileDevelopmentId: developmentId });
await this.developmentProjectRepository.delete({
profileDevelopmentHistory: { profileDevelopmentId: developmentId },
});
await this.developmentHistoryRepository.delete({
profileDevelopmentId: developmentId,
});

View file

@ -25,7 +25,6 @@ import {
UpdateProfileDevelopment,
} from "../entities/ProfileDevelopment";
import permission from "../interfaces/permission";
import { DevelopmentProject } from "../entities/developmentProject";
@Route("api/v1/org/profile-employee/development")
@Tags("ProfileDevelopment")
@Security("bearerAuth")
@ -33,7 +32,6 @@ export class ProfileDevelopmentEmployeeController extends Controller {
private profileRepository = AppDataSource.getRepository(ProfileEmployee);
private developmentRepository = AppDataSource.getRepository(ProfileDevelopment);
private developmentHistoryRepository = AppDataSource.getRepository(ProfileDevelopmentHistory);
private developmentProjectRepository = AppDataSource.getRepository(DevelopmentProject);
@Get("user")
public async getDevelopmentUser(@Request() request: RequestWithUser) {
@ -43,7 +41,6 @@ export class ProfileDevelopmentEmployeeController extends Controller {
}
const lists = await this.developmentRepository.find({
where: { profileEmployeeId: profile.id },
relations: ["developmentProjects"],
});
return new HttpSuccess(lists);
}
@ -53,7 +50,6 @@ export class ProfileDevelopmentEmployeeController extends Controller {
await new permission().PermissionOrgUserList(req, "SYS_REGISTRY_EMP", profileId);
const lists = await this.developmentRepository.find({
where: { profileEmployeeId: profileId },
relations: ["developmentProjects"],
});
return new HttpSuccess(lists);
}
@ -70,7 +66,6 @@ export class ProfileDevelopmentEmployeeController extends Controller {
}
const record = await this.developmentHistoryRepository.find({
where: { profileDevelopmentId: developmentId },
relations: ["developmentHistoryProjects"],
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
@ -108,28 +103,6 @@ export class ProfileDevelopmentEmployeeController extends Controller {
history.profileDevelopmentId = data.id;
await this.developmentHistoryRepository.save(history);
if (body.developmentProjects != null) {
await Promise.all(
body.developmentProjects.map(async (x) => {
let data1 = new DevelopmentProject();
data1.name = x;
data1.createdUserId = req.user.sub;
data1.createdFullName = req.user.name;
data1.lastUpdateUserId = req.user.sub;
data1.lastUpdateFullName = req.user.name;
data1.profileDevelopmentId = data.id;
await this.developmentProjectRepository.save(data1);
let data2 = new DevelopmentProject();
data2.name = x;
data2.createdUserId = req.user.sub;
data2.createdFullName = req.user.name;
data2.lastUpdateUserId = req.user.sub;
data2.lastUpdateFullName = req.user.name;
data2.profileDevelopmentId = data.id;
await this.developmentProjectRepository.save(data2);
}),
);
}
return new HttpSuccess();
}
@ -141,7 +114,6 @@ export class ProfileDevelopmentEmployeeController extends Controller {
) {
const record = await this.developmentRepository.findOne({
where: { id: developmentId },
relations: ["developmentProjects"],
});
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
await new permission().PermissionOrgUserUpdate(
@ -167,30 +139,6 @@ export class ProfileDevelopmentEmployeeController extends Controller {
this.developmentRepository.save(record),
this.developmentHistoryRepository.save(history),
]);
await this.developmentProjectRepository.remove(record.developmentProjects);
if (body.developmentProjects != null) {
await Promise.all(
body.developmentProjects.map(async (x) => {
let data1 = new DevelopmentProject();
data1.name = x;
data1.createdUserId = req.user.sub;
data1.createdFullName = req.user.name;
data1.lastUpdateUserId = req.user.sub;
data1.lastUpdateFullName = req.user.name;
data1.profileDevelopmentId = record.id;
await this.developmentProjectRepository.save(data1);
let data2 = new DevelopmentProject();
data2.name = x;
data2.createdUserId = req.user.sub;
data2.createdFullName = req.user.name;
data2.lastUpdateUserId = req.user.sub;
data2.lastUpdateFullName = req.user.name;
data2.profileDevelopmentId = history.id;
await this.developmentProjectRepository.save(data2);
}),
);
}
return new HttpSuccess();
}
@ -205,10 +153,6 @@ export class ProfileDevelopmentEmployeeController extends Controller {
_record.profileEmployeeId,
);
}
await this.developmentProjectRepository.delete({ profileDevelopmentId: developmentId });
await this.developmentProjectRepository.delete({
profileDevelopmentHistory: { profileDevelopmentId: developmentId },
});
await this.developmentHistoryRepository.delete({
profileDevelopmentId: developmentId,

View file

@ -25,7 +25,6 @@ import {
UpdateProfileDevelopment,
} from "../entities/ProfileDevelopment";
import permission from "../interfaces/permission";
import { DevelopmentProject } from "../entities/developmentProject";
@Route("api/v1/org/profile-temp/development")
@Tags("ProfileDevelopment")
@Security("bearerAuth")
@ -33,7 +32,6 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
private profileRepository = AppDataSource.getRepository(ProfileEmployee);
private developmentRepository = AppDataSource.getRepository(ProfileDevelopment);
private developmentHistoryRepository = AppDataSource.getRepository(ProfileDevelopmentHistory);
private developmentProjectRepository = AppDataSource.getRepository(DevelopmentProject);
@Get("user")
public async getDevelopmentUser(@Request() request: { user: Record<string, any> }) {
@ -43,7 +41,6 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
}
const lists = await this.developmentRepository.find({
where: { profileEmployeeId: profile.id },
relations: ["developmentProjects"],
});
return new HttpSuccess(lists);
}
@ -53,7 +50,6 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const lists = await this.developmentRepository.find({
where: { profileEmployeeId: profileId },
relations: ["developmentProjects"],
});
return new HttpSuccess(lists);
}
@ -63,7 +59,6 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
await new permission().PermissionList(req, "SYS_REGISTRY_TEMP");
const record = await this.developmentHistoryRepository.find({
where: { profileDevelopmentId: developmentId },
relations: ["developmentHistoryProjects"],
order: { createdAt: "DESC" },
});
return new HttpSuccess(record);
@ -102,28 +97,6 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
history.profileDevelopmentId = data.id;
await this.developmentHistoryRepository.save(history);
if (body.developmentProjects != null) {
await Promise.all(
body.developmentProjects.map(async (x) => {
let data1 = new DevelopmentProject();
data1.name = x;
data1.createdUserId = req.user.sub;
data1.createdFullName = req.user.name;
data1.lastUpdateUserId = req.user.sub;
data1.lastUpdateFullName = req.user.name;
data1.profileDevelopmentId = data.id;
await this.developmentProjectRepository.save(data1);
let data2 = new DevelopmentProject();
data2.name = x;
data2.createdUserId = req.user.sub;
data2.createdFullName = req.user.name;
data2.lastUpdateUserId = req.user.sub;
data2.lastUpdateFullName = req.user.name;
data2.profileDevelopmentId = data.id;
await this.developmentProjectRepository.save(data2);
}),
);
}
return new HttpSuccess();
}
@ -136,7 +109,6 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
const record = await this.developmentRepository.findOne({
where: { id: developmentId },
relations: ["developmentProjects"],
});
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
@ -158,30 +130,6 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
this.developmentRepository.save(record),
this.developmentHistoryRepository.save(history),
]);
await this.developmentProjectRepository.remove(record.developmentProjects);
if (body.developmentProjects != null) {
await Promise.all(
body.developmentProjects.map(async (x) => {
let data1 = new DevelopmentProject();
data1.name = x;
data1.createdUserId = req.user.sub;
data1.createdFullName = req.user.name;
data1.lastUpdateUserId = req.user.sub;
data1.lastUpdateFullName = req.user.name;
data1.profileDevelopmentId = record.id;
await this.developmentProjectRepository.save(data1);
let data2 = new DevelopmentProject();
data2.name = x;
data2.createdUserId = req.user.sub;
data2.createdFullName = req.user.name;
data2.lastUpdateUserId = req.user.sub;
data2.lastUpdateFullName = req.user.name;
data2.profileDevelopmentId = history.id;
await this.developmentProjectRepository.save(data2);
}),
);
}
return new HttpSuccess();
}
@ -189,10 +137,6 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
@Delete("{developmentId}")
public async deleteDevelopment(@Path() developmentId: string, @Request() req: RequestWithUser) {
await new permission().PermissionDelete(req, "SYS_REGISTRY_TEMP");
await this.developmentProjectRepository.delete({ profileDevelopmentId: developmentId });
await this.developmentProjectRepository.delete({
profileDevelopmentHistory: { profileDevelopmentId: developmentId },
});
await this.developmentHistoryRepository.delete({
profileDevelopmentId: developmentId,
});

View file

@ -112,11 +112,13 @@ export class ProfileDevelopment extends EntityBase {
})
reasonDevelopment10: string;
@OneToMany(
() => DevelopmentProject,
(developmentProject: DevelopmentProject) => developmentProject.profileDevelopment,
)
developmentProjects: DevelopmentProject[];
@Column({
nullable: true,
length: 40,
comment: "id kpi development",
default: null,
})
kpiDevelopmentId: string;
@OneToMany(
() => ProfileDevelopmentHistory,
@ -140,7 +142,7 @@ export class CreateProfileDevelopment {
achievement10?: string | null;
achievement5?: string | null;
achievement0?: string | null;
developmentProjects?: string[];
kpiDevelopmentId?: string | null;
reasonDevelopment70?: string;
reasonDevelopment20?: string;
reasonDevelopment10?: string;
@ -158,7 +160,7 @@ export class CreateProfileEmployeeDevelopment {
achievement10?: string | null;
achievement5?: string | null;
achievement0?: string | null;
developmentProjects?: string[];
kpiDevelopmentId?: string;
reasonDevelopment70?: string;
reasonDevelopment20?: string;
reasonDevelopment10?: string;
@ -175,7 +177,7 @@ export type UpdateProfileDevelopment = {
achievement10?: string | null;
achievement5?: string | null;
achievement0?: string | null;
developmentProjects?: string[];
kpiDevelopmentId?: string;
reasonDevelopment70?: string;
reasonDevelopment20?: string;
reasonDevelopment10?: string;

View file

@ -94,12 +94,13 @@ export class ProfileDevelopmentHistory extends EntityBase {
})
reasonDevelopment10: string;
@OneToMany(
() => DevelopmentProject,
(developmentHistoryProject: DevelopmentProject) =>
developmentHistoryProject.profileDevelopmentHistory,
)
developmentHistoryProjects: DevelopmentProject[];
@Column({
nullable: true,
length: 40,
comment: "id kpi development",
default: null,
})
kpiDevelopmentId: string;
@Column({
nullable: true,

View file

@ -29,26 +29,12 @@ export class DevelopmentProject extends EntityBase {
})
profileDevelopmentId: string;
@ManyToOne(
() => ProfileDevelopment,
(profileDevelopment: ProfileDevelopment) => profileDevelopment.developmentProjects,
)
@JoinColumn({ name: "profileDevelopmentId" })
profileDevelopment: ProfileDevelopment;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
profileDevelopmentHistoryId: string;
@ManyToOne(
() => ProfileDevelopmentHistory,
(profileDevelopmentHistory: ProfileDevelopmentHistory) => profileDevelopmentHistory.developmentHistoryProjects,
)
@JoinColumn({ name: "profileDevelopmentHistoryId" })
profileDevelopmentHistory: ProfileDevelopmentHistory;
}
export class CreateDevelopmentProject {
@Column()

View file

@ -0,0 +1,42 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddProfiledevelopment11724754372183 implements MigrationInterface {
name = 'AddProfiledevelopment11724754372183'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_4913ef1466f9f35c1429e213d4b\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` DROP FOREIGN KEY \`FK_8e3f2e86427befeff4283ae80f0\``);
// await queryRunner.query(`CREATE TABLE \`subDistrictImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`DISTRICT_CODE\` varchar(255) NULL, \`DISTRICT_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`provinceImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`PROVINCE_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_POSITION_OFFICER\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`MP_POS_DATE\` text NULL, \`SALARY\` text NULL, \`MP_COMMAND_NUM\` text NULL, \`POS_NUM_NAME\` text NULL, \`POS_NUM_CODE\` text NULL, \`FLAG_TO_NAME\` text NULL, \`WORK_LINE_NAME\` text NULL, \`SPECIALIST_NAME\` text NULL, \`ADMIN_NAME\` text NULL, \`REMARK\` text NULL, \`ORDER_MOVE_POSITION\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_OFFICER_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_FAMILY\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`FATHER_RANK_NAME\` text NULL, \`FATHER_FNAME\` text NULL, \`FATHER_LNAME\` text NULL, \`MOTHER_RANK_NAME\` text NULL, \`MOTHER_FNAME\` text NULL, \`MOTHER_LNAME\` text NULL, \`SPOUSE_RANK_NAME\` text NULL, \`SPOUSE_FNAME\` text NULL, \`SPOUSE_LNAME\` text NULL, \`SPOUSE_ID\` text NULL, \`MARRIAGE_STATE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION_EMP\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_PERSONAL_EMP_ADDRESS\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`PROVINCE_CODE\` text NULL, \`AMPHUR_CODE\` text NULL, \`DISTRICT_CODE\` text NULL, \`CONTACT_PROVINCE_CODE\` text NULL, \`CONTACT_AMPHUR_CODE\` text NULL, \`CONTACT_DISTRICT_CODE\` text NULL, \`H_NUMBER\` text NULL, \`ZIPCODE\` text NULL, \`CONTACT_H_NUMBER\` text NULL, \`CONTACT_ZIPCODE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`HR_EDUCATION\` (\`CIT\` text NULL, \`id\` int NOT NULL AUTO_INCREMENT, \`EDUCATION_CODE\` text NULL, \`START_EDUCATION_YEAR\` text NULL, \`EDUCATION_YEAR\` text NULL, \`INSTITUE\` text NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`educationMis\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`EDUCATION_CODE\` varchar(255) NULL, \`EDUCATION_NAME\` varchar(255) NULL, \`EDUCATION_ABB_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
// await queryRunner.query(`CREATE TABLE \`amphurImport\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`PROVINCE_CODE\` varchar(255) NULL, \`AMPHUR_CODE\` varchar(255) NULL, \`AMPHUR_NAME\` varchar(255) NULL, PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` ADD \`kpiDevelopmentId\` varchar(40) NULL COMMENT 'id kpi development'`);
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` ADD \`kpiDevelopmentId\` varchar(40) NULL COMMENT 'id kpi development'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileDevelopment\` DROP COLUMN \`kpiDevelopmentId\``);
await queryRunner.query(`ALTER TABLE \`profileDevelopmentHistory\` DROP COLUMN \`kpiDevelopmentId\``);
// await queryRunner.query(`DROP TABLE \`amphurImport\``);
// await queryRunner.query(`DROP TABLE \`educationMis\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_EDUCATION_EMP\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_EMP_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_ADDRESS\``);
// await queryRunner.query(`DROP TABLE \`HR_POSITION_OFFICER\``);
// await queryRunner.query(`DROP TABLE \`HR_PERSONAL_OFFICER_FAMILY\``);
// await queryRunner.query(`DROP TABLE \`provinceImport\``);
// await queryRunner.query(`DROP TABLE \`subDistrictImport\``);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_8e3f2e86427befeff4283ae80f0\` FOREIGN KEY (\`profileDevelopmentHistoryId\`) REFERENCES \`profileDevelopmentHistory\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentProject\` ADD CONSTRAINT \`FK_4913ef1466f9f35c1429e213d4b\` FOREIGN KEY (\`profileDevelopmentId\`) REFERENCES \`profileDevelopment\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}