Merge branch 'develop' into dev

* develop:
  add permission brother
  migrate
This commit is contained in:
Warunee Tamkoo 2025-12-12 09:34:22 +07:00
commit 04eb563eb3
14 changed files with 296 additions and 53 deletions

View file

@ -1551,7 +1551,7 @@ export class DevelopmentController extends Controller {
if (!development) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงการ/หลักสูตรการฝึกอบรมนี้");
}
Object.assign(development, { ...requestBody});
Object.assign(development, { ...requestBody });
development.lastUpdateUserId = request.user.sub;
development.lastUpdateFullName = request.user.name;
development.lastUpdatedAt = new Date();
@ -2085,7 +2085,7 @@ export class DevelopmentController extends Controller {
_data.child1 != undefined && _data.child1 != null
? _data.child1[0] != null
? `development.child1DnaId IN (:...child1)`
: `development.child1DnaId is null`
: `development.child1DnaId is ${_data.privilege == "PARENT" ? "not null" : "null"}`
: "1=1",
{
child1: _data.child1,
@ -2130,19 +2130,15 @@ export class DevelopmentController extends Controller {
"development.child2",
"development.child3",
"development.child4",
])
]);
if (sortBy) {
query = query.orderBy(
`development.${sortBy}`,
descending ? "DESC" : "ASC"
);
}else{
query = query.orderBy("development.year", "DESC")
.addOrderBy("development.createdAt", "DESC")
}
if (sortBy) {
query = query.orderBy(`development.${sortBy}`, descending ? "DESC" : "ASC");
} else {
query = query.orderBy("development.year", "DESC").addOrderBy("development.createdAt", "DESC");
}
const [development, total] = await query
const [development, total] = await query
.skip((page - 1) * pageSize)
.take(pageSize)
.getManyAndCount();
@ -2575,6 +2571,7 @@ export class DevelopmentController extends Controller {
isDone: "ASC",
isDoneIDP: "ASC",
citizenId: "ASC",
type: "DESC",
},
});
const _getDevelopment = getDevelopment.map((item) => ({
@ -2631,12 +2628,13 @@ export class DevelopmentController extends Controller {
});
const developmentAddresss = await this.developmentAddresssRepository.find({
where: { developmentId: id}
})
where: { developmentId: id },
});
const places = developmentAddresss
.map(addr =>
`- ${addr.address}, ${addr.addressType === "IN_COUNTRY" ? addr.provinceName : addr.country} (${addr.addressType === "IN_COUNTRY" ? "ภายในประเทศ" : "ภายนอกประเทศ"})`
.map(
(addr) =>
`- ${addr.address}, ${addr.addressType === "IN_COUNTRY" ? addr.provinceName : addr.country} (${addr.addressType === "IN_COUNTRY" ? "ภายในประเทศ" : "ภายนอกประเทศ"})`,
)
.filter(Boolean)
.join("\n");
@ -2767,7 +2765,7 @@ export class DevelopmentController extends Controller {
techniqueActuals.length > 0 && dev20Lists.some((item) => techniqueActuals.includes(item));
isDevelopment10 =
techniqueActuals.length > 0 && dev10Lists.some((item) => techniqueActuals.includes(item));
if (x.type == "OFFICER") {
await new CallAPI()
.PostData(request, "/org/profile/development", {

View file

@ -71,6 +71,9 @@ export class ActualGoal extends EntityBase {
type: string;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(คน)",
default: null,

View file

@ -12,6 +12,9 @@ export class ActualPeople extends EntityBase {
groupTarget: string;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(คน)",
default: null,

View file

@ -183,8 +183,8 @@ export class Development extends EntityBase {
year: number;
@Column({
type: "longtext",
comment: "ชื่อโครงการ/กิจกรรม/หลักสูตร",
length: 255,
})
projectName: string;
@ -192,7 +192,7 @@ export class Development extends EntityBase {
nullable: true,
comment: "หลักการและเหตุผล",
default: null,
type: "text",
type: "longtext",
})
reason: string;
@ -200,7 +200,7 @@ export class Development extends EntityBase {
nullable: true,
comment: "วัตถุประสงค์",
default: null,
type: "text",
type: "longtext",
})
objective: string;
@ -254,6 +254,9 @@ export class Development extends EntityBase {
isHoldPlanned: boolean;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(วัน)(ไป-กลับ)",
default: null,
@ -261,6 +264,9 @@ export class Development extends EntityBase {
projectDayBackPlanned: number;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(วัน)(พักค้าง)",
default: null,
@ -268,6 +274,9 @@ export class Development extends EntityBase {
projectDayHoldPlanned: number;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(คืน)(พักค้าง)",
default: null,
@ -287,6 +296,9 @@ export class Development extends EntityBase {
isHoldActual: boolean;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(วัน)(ไป-กลับ)",
default: null,
@ -294,6 +306,9 @@ export class Development extends EntityBase {
projectDayBackActual: number;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(วัน)(พักค้าง)",
default: null,
@ -301,6 +316,9 @@ export class Development extends EntityBase {
projectDayHoldActual: number;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(คืน)(พักค้าง)",
default: null,
@ -308,6 +326,7 @@ export class Development extends EntityBase {
projectNigthHoldActual: number;
@Column({
type: "longtext",
nullable: true,
comment: "รายละเอียดอื่นๆ 70 แผน",
default: null,
@ -315,6 +334,7 @@ export class Development extends EntityBase {
reasonPlanned70: string;
@Column({
type: "longtext",
nullable: true,
comment: "รายละเอียดอื่นๆ 20 แผน",
default: null,
@ -322,6 +342,7 @@ export class Development extends EntityBase {
reasonPlanned20: string;
@Column({
type: "longtext",
nullable: true,
comment: "รายละเอียดอื่นๆ 10 แผน",
default: null,
@ -400,6 +421,9 @@ export class Development extends EntityBase {
developmentProjectTechniqueActuals: DevelopmentProjectTechniqueActual[];
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(รุ่น)ตามแผน",
default: null,
@ -407,6 +431,9 @@ export class Development extends EntityBase {
projectModalPlanned: number;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(รุ่น)ตามจริง",
default: null,
@ -573,6 +600,7 @@ export class Development extends EntityBase {
riskManagement: string;
@Column({
type: "longtext",
nullable: true,
comment: "ประโยชน์ที่คาดว่าจะได้รับ",
default: null,
@ -580,6 +608,7 @@ export class Development extends EntityBase {
expect: string;
@Column({
type: "longtext",
nullable: true,
comment: "หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน",
default: null,
@ -587,6 +616,7 @@ export class Development extends EntityBase {
topicAcademic: string;
@Column({
type: "longtext",
nullable: true,
comment: "สถานที่ฝึกอบรม ศึกษาดูงาน",
default: null,

View file

@ -5,6 +5,7 @@ import { Development } from "./Development";
@Entity("developmentEvaluation")
export class DevelopmentEvaluation extends EntityBase {
@Column({
type: "longtext",
nullable: true,
comment: "ตัวชี้วัด",
default: null,
@ -12,6 +13,9 @@ export class DevelopmentEvaluation extends EntityBase {
indicators: string;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "เป้าหมาย",
default: null,
@ -26,6 +30,7 @@ export class DevelopmentEvaluation extends EntityBase {
metricType: string;
@Column({
type: "longtext",
nullable: true,
comment: "วิธีการคำนวณ/เครื่องมือ",
default: null,
@ -33,6 +38,7 @@ export class DevelopmentEvaluation extends EntityBase {
calculation: string;
@Column({
type: "longtext",
nullable: true,
comment: "ระยะเวลาวัดผล",
default: null,

View file

@ -5,6 +5,7 @@ import { Development } from "./Development";
@Entity("developmentOther")
export class DevelopmentOther extends EntityBase {
@Column({
type: "longtext",
nullable: true,
comment: "หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน",
default: null,
@ -12,6 +13,7 @@ export class DevelopmentOther extends EntityBase {
topicAcademic: string;
@Column({
type: "longtext",
nullable: true,
comment: "สถานที่ฝึกอบรม ศึกษาดูงาน",
default: null,

View file

@ -5,6 +5,7 @@ import { Development } from "./Development";
@Entity("developmentRisk")
export class DevelopmentRisk extends EntityBase {
@Column({
type: "longtext",
nullable: true,
comment: "ประเด็นความเสี่ยง",
default: null,
@ -33,6 +34,7 @@ export class DevelopmentRisk extends EntityBase {
riskLevel: string;
@Column({
type: "longtext",
nullable: true,
comment: "เเนวทางการบริหารความเสี่ยง",
default: null,

View file

@ -318,9 +318,9 @@ export class DevelopmentScholarship extends EntityBase {
useOfficialTime: string;
@Column({
type: "longtext",
nullable: true,
comment: "เปลี่ยนแปลงรายละเอียด",
type: "text",
default: null,
})
changeDetail: string;

View file

@ -56,6 +56,9 @@ export class PlannedGoal extends EntityBase {
type: string;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(คน)",
default: null,

View file

@ -7,6 +7,7 @@ import { PlannedGoal } from "./PlannedGoal";
@Entity("plannedGoalPosition")
export class PlannedGoalPosition extends EntityBase {
@Column({
type: "longtext",
nullable: true,
comment: "ตำแหน่ง",
default: null,

View file

@ -12,6 +12,9 @@ export class PlannedPeople extends EntityBase {
groupTarget: string;
@Column({
type: "decimal",
precision: 65,
scale: 0,
nullable: true,
comment: "จำนวน(คน)",
default: null,

View file

@ -94,6 +94,15 @@ class CheckAuth {
child4: null,
privilege: "ROOT",
};
} else if (privilege == "PARENT") {
data = {
root: [x.orgRootId],
child1: [null],
child2: null,
child3: null,
child4: null,
privilege: "PARENT",
};
} else if (privilege == "CHILD") {
data = {
root: node >= 0 ? [x.orgRootId] : null,
@ -103,6 +112,15 @@ class CheckAuth {
child4: node >= 4 ? [x.orgChild4Id] : null,
privilege: "CHILD",
};
} else if (privilege == "BROTHER") {
data = {
// root: node >= 0 ? [x.orgRootId] : null,
root: node >= 0 ? [x.orgRootId] : null,
child1: node >= 2 ? [x.orgChild1Id] : null,
child2: node >= 3 ? [x.orgChild2Id] : null,
child3: node >= 4 ? [x.orgChild3Id] : null,
privilege: "BROTHER",
};
} else if (privilege == "NORMAL") {
data = {
root: [x.orgRootId],
@ -185,38 +203,38 @@ class CheckAuth {
}
public async checkOrg(token: any, keycloakId: string) {
const redisClient = await this.redis.createClient({
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
})
const getAsync = promisify(redisClient.get).bind(redisClient)
try {
let reply = await getAsync("org_" + keycloakId)
if (reply != null) {
reply = JSON.parse(reply)
} else {
if (!keycloakId) throw new Error("No KeycloakId provided")
const x = await new CallAPI().GetData(
{
headers: { authorization: token },
},
`/org/permission/checkOrg/${keycloakId}`,
false
)
host: process.env.REDIS_HOST,
port: process.env.REDIS_PORT,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
try {
let reply = await getAsync("org_" + keycloakId);
if (reply != null) {
reply = JSON.parse(reply);
} else {
if (!keycloakId) throw new Error("No KeycloakId provided");
const x = await new CallAPI().GetData(
{
headers: { authorization: token },
},
`/org/permission/checkOrg/${keycloakId}`,
false,
);
const data = {
orgRootId: x.orgRootId,
orgChild1Id: x.orgChild1Id,
orgChild2Id: x.orgChild2Id,
orgChild3Id: x.orgChild3Id,
orgChild4Id: x.orgChild4Id,
}
const data = {
orgRootId: x.orgRootId,
orgChild1Id: x.orgChild1Id,
orgChild2Id: x.orgChild2Id,
orgChild3Id: x.orgChild3Id,
orgChild4Id: x.orgChild4Id,
};
return data
}
} catch (error) {
console.error("Error calling API:", error)
throw error
}
return data;
}
} catch (error) {
console.error("Error calling API:", error);
throw error;
}
}
public async PermissionCreate(req: RequestWithUser, system: string) {
return await this.Permission(req, system, "CREATE");

View file

@ -0,0 +1,132 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateDatatypeFields1764651579684 implements MigrationInterface {
name = 'UpdateDatatypeFields1764651579684'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`actualPeople\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`actualPeople\` ADD \`amount\` decimal NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`plannedPeople\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`plannedPeople\` ADD \`amount\` decimal NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD \`amount\` decimal NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`plannedGoal\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`plannedGoal\` ADD \`amount\` decimal NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`changeDetail\``);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`changeDetail\` longtext NULL COMMENT 'เปลี่ยนแปลงรายละเอียด'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`indicators\``);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`indicators\` longtext NULL COMMENT 'ตัวชี้วัด'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`target\``);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`target\` decimal NULL COMMENT 'เป้าหมาย'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`calculation\``);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`calculation\` longtext NULL COMMENT 'วิธีการคำนวณ/เครื่องมือ'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`measuRement\``);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`measuRement\` longtext NULL COMMENT 'ระยะเวลาวัดผล'`);
await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP COLUMN \`issues\``);
await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD \`issues\` longtext NULL COMMENT 'ประเด็นความเสี่ยง'`);
await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP COLUMN \`riskManagement\``);
await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD \`riskManagement\` longtext NULL COMMENT 'เเนวทางการบริหารความเสี่ยง'`);
await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP COLUMN \`topicAcademic\``);
await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD \`topicAcademic\` longtext NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP COLUMN \`addressAcademic\``);
await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD \`addressAcademic\` longtext NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectName\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectName\` longtext NOT NULL COMMENT 'ชื่อโครงการ/กิจกรรม/หลักสูตร'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reason\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`reason\` longtext NULL COMMENT 'หลักการและเหตุผล'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`objective\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`objective\` longtext NULL COMMENT 'วัตถุประสงค์'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackPlanned\` decimal NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldPlanned\` decimal NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldPlanned\` decimal NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackActual\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackActual\` decimal NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldActual\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldActual\` decimal NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldActual\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldActual\` decimal NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned70\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned70\` longtext NULL COMMENT 'รายละเอียดอื่นๆ 70 แผน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned20\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned20\` longtext NULL COMMENT 'รายละเอียดอื่นๆ 20 แผน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned10\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned10\` longtext NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectModalPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectModalPlanned\` decimal NULL COMMENT 'จำนวน(รุ่น)ตามแผน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectModalActual\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectModalActual\` decimal NULL COMMENT 'จำนวน(รุ่น)ตามจริง'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`expect\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`expect\` longtext NULL COMMENT 'ประโยชน์ที่คาดว่าจะได้รับ'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`topicAcademic\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`topicAcademic\` longtext NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`addressAcademic\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`addressAcademic\` longtext NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`addressAcademic\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`addressAcademic\` varchar(255) NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`topicAcademic\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`topicAcademic\` varchar(255) NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`expect\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`expect\` varchar(255) NULL COMMENT 'ประโยชน์ที่คาดว่าจะได้รับ'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectModalActual\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectModalActual\` int NULL COMMENT 'จำนวน(รุ่น)ตามจริง'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectModalPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectModalPlanned\` int NULL COMMENT 'จำนวน(รุ่น)ตามแผน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned10\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned10\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 10 แผน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned20\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned20\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 20 แผน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reasonPlanned70\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`reasonPlanned70\` varchar(255) NULL COMMENT 'รายละเอียดอื่นๆ 70 แผน'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldActual\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldActual\` int NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldActual\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldActual\` int NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackActual\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackActual\` int NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldPlanned\` int NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldPlanned\` int NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackPlanned\` int NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`objective\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`objective\` text NULL COMMENT 'วัตถุประสงค์'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`reason\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`reason\` text NULL COMMENT 'หลักการและเหตุผล'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectName\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectName\` varchar(255) NOT NULL COMMENT 'ชื่อโครงการ/กิจกรรม/หลักสูตร'`);
await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP COLUMN \`addressAcademic\``);
await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD \`addressAcademic\` varchar(255) NULL COMMENT 'สถานที่ฝึกอบรม ศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`developmentOther\` DROP COLUMN \`topicAcademic\``);
await queryRunner.query(`ALTER TABLE \`developmentOther\` ADD \`topicAcademic\` varchar(255) NULL COMMENT 'หัวข้อ/ประเด็นการฝึกอบรม ศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP COLUMN \`riskManagement\``);
await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD \`riskManagement\` varchar(255) NULL COMMENT 'เเนวทางการบริหารความเสี่ยง'`);
await queryRunner.query(`ALTER TABLE \`developmentRisk\` DROP COLUMN \`issues\``);
await queryRunner.query(`ALTER TABLE \`developmentRisk\` ADD \`issues\` varchar(255) NULL COMMENT 'ประเด็นความเสี่ยง'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`measuRement\``);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`measuRement\` varchar(255) NULL COMMENT 'ระยะเวลาวัดผล'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`calculation\``);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`calculation\` varchar(255) NULL COMMENT 'วิธีการคำนวณ/เครื่องมือ'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`target\``);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`target\` int NULL COMMENT 'เป้าหมาย'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP COLUMN \`indicators\``);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD \`indicators\` varchar(255) NULL COMMENT 'ตัวชี้วัด'`);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`changeDetail\``);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`changeDetail\` text NULL COMMENT 'เปลี่ยนแปลงรายละเอียด'`);
await queryRunner.query(`ALTER TABLE \`plannedGoal\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`plannedGoal\` ADD \`amount\` int NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD \`amount\` int NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`plannedPeople\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`plannedPeople\` ADD \`amount\` int NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`actualPeople\` DROP COLUMN \`amount\``);
await queryRunner.query(`ALTER TABLE \`actualPeople\` ADD \`amount\` int NULL COMMENT 'จำนวน(คน)'`);
}
}

View file

@ -0,0 +1,42 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateDatatypeFieldsTwo1764738754427 implements MigrationInterface {
name = 'UpdateDatatypeFieldsTwo1764738754427'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`actualPeople\` CHANGE \`amount\` \`amount\` decimal(65,0) NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`plannedPeople\` CHANGE \`amount\` \`amount\` decimal(65,0) NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`actualGoal\` CHANGE \`amount\` \`amount\` decimal(65,0) NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP COLUMN \`position\``);
await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD \`position\` longtext NULL COMMENT 'ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`plannedGoal\` CHANGE \`amount\` \`amount\` decimal(65,0) NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` CHANGE \`target\` \`target\` decimal(65,0) NULL COMMENT 'เป้าหมาย'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayBackPlanned\` \`projectDayBackPlanned\` decimal(65,0) NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayHoldPlanned\` \`projectDayHoldPlanned\` decimal(65,0) NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectNigthHoldPlanned\` \`projectNigthHoldPlanned\` decimal(65,0) NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayBackActual\` \`projectDayBackActual\` decimal(65,0) NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayHoldActual\` \`projectDayHoldActual\` decimal(65,0) NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectNigthHoldActual\` \`projectNigthHoldActual\` decimal(65,0) NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectModalPlanned\` \`projectModalPlanned\` decimal(65,0) NULL COMMENT 'จำนวน(รุ่น)ตามแผน'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectModalActual\` \`projectModalActual\` decimal(65,0) NULL COMMENT 'จำนวน(รุ่น)ตามจริง'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectModalActual\` \`projectModalActual\` decimal(10,0) NULL COMMENT 'จำนวน(รุ่น)ตามจริง'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectModalPlanned\` \`projectModalPlanned\` decimal(10,0) NULL COMMENT 'จำนวน(รุ่น)ตามแผน'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectNigthHoldActual\` \`projectNigthHoldActual\` decimal(10,0) NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayHoldActual\` \`projectDayHoldActual\` decimal(10,0) NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayBackActual\` \`projectDayBackActual\` decimal(10,0) NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectNigthHoldPlanned\` \`projectNigthHoldPlanned\` decimal(10,0) NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayHoldPlanned\` \`projectDayHoldPlanned\` decimal(10,0) NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` CHANGE \`projectDayBackPlanned\` \`projectDayBackPlanned\` decimal(10,0) NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` CHANGE \`target\` \`target\` decimal(10,0) NULL COMMENT 'เป้าหมาย'`);
await queryRunner.query(`ALTER TABLE \`plannedGoal\` CHANGE \`amount\` \`amount\` decimal(10,0) NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP COLUMN \`position\``);
await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`actualGoal\` CHANGE \`amount\` \`amount\` decimal(10,0) NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`plannedPeople\` CHANGE \`amount\` \`amount\` decimal(10,0) NULL COMMENT 'จำนวน(คน)'`);
await queryRunner.query(`ALTER TABLE \`actualPeople\` CHANGE \`amount\` \`amount\` decimal(10,0) NULL COMMENT 'จำนวน(คน)'`);
}
}