From 7d862c076fb302c54e9cc79de22e1a1965ccd799 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:07:22 +0700 Subject: [PATCH 1/5] chore: add note to example --- src/controllers/ProfileEducationsController.ts | 3 +++ src/controllers/ProfileInsigniaController.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/controllers/ProfileEducationsController.ts b/src/controllers/ProfileEducationsController.ts index c12cf4bd..0a31993e 100644 --- a/src/controllers/ProfileEducationsController.ts +++ b/src/controllers/ProfileEducationsController.ts @@ -70,6 +70,7 @@ export class ProfileEducationsController extends Controller { educationLevelId: "string", positionPath: "string", positionPathId: "string", + note: "string", isDate: true, isEducation: true, }, @@ -113,6 +114,7 @@ export class ProfileEducationsController extends Controller { educationLevelId: "string", positionPath: "string", positionPathId: "string", + note: "string", isDate: true, isEducation: true, profileEducationId: "f6c693b4-1a9b-4fbe-95c5-ed4da50d35b6", @@ -142,6 +144,7 @@ export class ProfileEducationsController extends Controller { educationLevelId: "string", positionPath: "string", positionPathId: "string", + note: "string", isDate: true, isEducation: true, profileEducationId: "f6c693b4-1a9b-4fbe-95c5-ed4da50d35b6", diff --git a/src/controllers/ProfileInsigniaController.ts b/src/controllers/ProfileInsigniaController.ts index a999b495..bdd04120 100644 --- a/src/controllers/ProfileInsigniaController.ts +++ b/src/controllers/ProfileInsigniaController.ts @@ -61,6 +61,7 @@ export class ProfileInsigniaController extends Controller { volumeNo: "string", refCommandDate: "2024-03-12T10:05:02.000Z", refCommandNo: "string", + note: "string", }, ], }) @@ -96,6 +97,7 @@ export class ProfileInsigniaController extends Controller { volumeNo: "volumeNo", refCommandDate: "2024-03-12T10:05:44.000Z", refCommandNo: "refCommandNo", + note: "string", profileInsigniaId: "c9d4dd52-25f5-491a-852d-28bfe00d66cb", }, { @@ -120,6 +122,7 @@ export class ProfileInsigniaController extends Controller { volumeNo: "string", refCommandDate: "2024-03-12T10:05:02.000Z", refCommandNo: "string", + note: "string", profileInsigniaId: "c9d4dd52-25f5-491a-852d-28bfe00d66cb", }, ], From 7bc2915788dc15e6895d7d7daf81c1f8d9345f26 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:11:17 +0700 Subject: [PATCH 2/5] fix: add note to create interface --- src/entities/ProfileEducation.ts | 3 +++ src/entities/ProfileInsignia.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/entities/ProfileEducation.ts b/src/entities/ProfileEducation.ts index 88991be8..bc96e7da 100644 --- a/src/entities/ProfileEducation.ts +++ b/src/entities/ProfileEducation.ts @@ -234,6 +234,9 @@ export class CreateProfileEducation { @Column() isEducation: boolean | null; + + @Column() + note: string | null; } export type UpdateProfileEducation = Partial; diff --git a/src/entities/ProfileInsignia.ts b/src/entities/ProfileInsignia.ts index 7c883dc6..1d7cdc22 100644 --- a/src/entities/ProfileInsignia.ts +++ b/src/entities/ProfileInsignia.ts @@ -180,6 +180,9 @@ export class CreateProfileInsignia { @Column() refCommandNo: string | null; + + @Column() + note: string | null; } export type UpdateProfileInsignia = Partial; From 991e954580a2899e38d33b71d6afa109554233b4 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:11:27 +0700 Subject: [PATCH 3/5] chore: format --- src/entities/ProfileEducation.ts | 10 ++++++---- src/entities/ProfileInsignia.ts | 19 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/entities/ProfileEducation.ts b/src/entities/ProfileEducation.ts index bc96e7da..974d68ab 100644 --- a/src/entities/ProfileEducation.ts +++ b/src/entities/ProfileEducation.ts @@ -115,7 +115,7 @@ export class ProfileEducation extends EntityBase { @Column({ nullable: true, comment: "ระดับศึกษา", - type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text + type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text default: null, }) educationLevel: string; @@ -164,14 +164,16 @@ export class ProfileEducation extends EntityBase { default: null, }) isEducation: boolean; - - @OneToMany(() => ProfileEducationHistory, (profileEducationHistory) => profileEducationHistory.histories) + + @OneToMany( + () => ProfileEducationHistory, + (profileEducationHistory) => profileEducationHistory.histories, + ) profileEducationHistories: ProfileEducationHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileEducations) @JoinColumn({ name: "profileId" }) profile: Profile; - } export class CreateProfileEducation { diff --git a/src/entities/ProfileInsignia.ts b/src/entities/ProfileInsignia.ts index 1d7cdc22..cc7c1298 100644 --- a/src/entities/ProfileInsignia.ts +++ b/src/entities/ProfileInsignia.ts @@ -47,7 +47,7 @@ export class ProfileInsignia extends EntityBase { default: null, }) section: string; - + @Column({ nullable: true, length: 30, @@ -63,7 +63,7 @@ export class ProfileInsignia extends EntityBase { default: null, }) receiveDate: Date; - + @Column({ nullable: true, length: 40, @@ -71,7 +71,7 @@ export class ProfileInsignia extends EntityBase { default: null, }) insigniaId: string; - + @Column({ nullable: true, comment: "ประเภท", @@ -127,7 +127,10 @@ export class ProfileInsignia extends EntityBase { }) note: string; - @OneToMany(() => ProfileInsigniaHistory, (profileInsigniaHistory) => profileInsigniaHistory.histories) + @OneToMany( + () => ProfileInsigniaHistory, + (profileInsigniaHistory) => profileInsigniaHistory.histories, + ) profileInsigniaHistories: ProfileInsigniaHistory[]; @ManyToOne(() => Profile, (profile) => profile.profileInsignias) @@ -141,7 +144,7 @@ export class CreateProfileInsignia { @Column() isActive: boolean; - + @Column() year: number; @@ -153,16 +156,16 @@ export class CreateProfileInsignia { @Column() section: string | null; - + @Column() page: string | null; @Column() receiveDate: Date | null; - + @Column("uuid") insigniaId: string | null; - + @Column() insigniaType: string | null; From 93c20a4c9669f11bf9e47cc5aaa477d183ce01b4 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:15:16 +0700 Subject: [PATCH 4/5] feat: add note to history --- src/entities/ProfileEducationHistory.ts | 21 ++++++++++++++------ src/entities/ProfileInsigniaHistory.ts | 26 ++++++++++++++++--------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/entities/ProfileEducationHistory.ts b/src/entities/ProfileEducationHistory.ts index c1d6cc33..3454130c 100644 --- a/src/entities/ProfileEducationHistory.ts +++ b/src/entities/ProfileEducationHistory.ts @@ -5,7 +5,6 @@ import { ProfileEducation } from "./ProfileEducation"; @Entity("profileEducationHistory") export class ProfileEducationHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -108,7 +107,7 @@ export class ProfileEducationHistory extends EntityBase { @Column({ nullable: true, comment: "ระดับศึกษา", - type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text + type: "text", // ใช้ "text" แทน "string" เพื่อรองรับ long text default: null, }) educationLevel: string; @@ -151,6 +150,13 @@ export class ProfileEducationHistory extends EntityBase { }) isEducation: boolean; + @Column({ + nullable: true, + comment: "หมายเหตุ", + default: null, + }) + note: string; + @Column({ nullable: true, length: 40, @@ -158,15 +164,16 @@ export class ProfileEducationHistory extends EntityBase { default: null, }) profileEducationId: string; - - @ManyToOne(() => ProfileEducation, (profileEducation) => profileEducation.profileEducationHistories) + + @ManyToOne( + () => ProfileEducation, + (profileEducation) => profileEducation.profileEducationHistories, + ) @JoinColumn({ name: "profileEducationId" }) histories: ProfileEducation; - } export class CreateProfileEducationHistory { - @Column() isActive: boolean; @@ -227,6 +234,8 @@ export class CreateProfileEducationHistory { @Column("uuid") profileEducationId: string | null; + @Column() + note: string | null; } export type UpdateProfileEducationHistory = Partial; diff --git a/src/entities/ProfileInsigniaHistory.ts b/src/entities/ProfileInsigniaHistory.ts index a03c4b83..7ca99f56 100644 --- a/src/entities/ProfileInsigniaHistory.ts +++ b/src/entities/ProfileInsigniaHistory.ts @@ -5,7 +5,6 @@ import { ProfileInsignia } from "./ProfileInsignia"; @Entity("profileInsigniaHistory") export class ProfileInsigniaHistory extends EntityBase { - @Column({ comment: "สถานะการใช้งาน", default: false, @@ -40,7 +39,7 @@ export class ProfileInsigniaHistory extends EntityBase { default: null, }) section: string; - + @Column({ nullable: true, length: 30, @@ -56,7 +55,7 @@ export class ProfileInsigniaHistory extends EntityBase { default: null, }) receiveDate: Date; - + @Column({ nullable: true, length: 40, @@ -64,7 +63,7 @@ export class ProfileInsigniaHistory extends EntityBase { default: null, }) insigniaId: string; - + @Column({ nullable: true, comment: "ประเภท", @@ -113,6 +112,13 @@ export class ProfileInsigniaHistory extends EntityBase { }) refCommandNo: string; + @Column({ + nullable: true, + comment: "หมายเหตุ", + default: null, + }) + note: string; + @Column({ nullable: true, length: 40, @@ -127,10 +133,9 @@ export class ProfileInsigniaHistory extends EntityBase { } export class CreateProfileInsigniaHistory { - @Column() isActive: boolean; - + @Column() year: number; @@ -142,16 +147,16 @@ export class CreateProfileInsigniaHistory { @Column() section: string | null; - + @Column() page: string | null; @Column() receiveDate: Date | null; - + @Column("uuid") insigniaId: string | null; - + @Column() insigniaType: string | null; @@ -170,6 +175,9 @@ export class CreateProfileInsigniaHistory { @Column() refCommandNo: string | null; + @Column() + note: string | null; + @Column("uuid") profileInsigniaId: string | null; } From 340289a670ac9e806a6420f52a162ce0fd6d4116 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Mon, 18 Mar 2024 15:20:34 +0700 Subject: [PATCH 5/5] chore: add migration --- ...7773-update_table_profile_history_add_note.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/migration/1710749867773-update_table_profile_history_add_note.ts diff --git a/src/migration/1710749867773-update_table_profile_history_add_note.ts b/src/migration/1710749867773-update_table_profile_history_add_note.ts new file mode 100644 index 00000000..1d3cc342 --- /dev/null +++ b/src/migration/1710749867773-update_table_profile_history_add_note.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileHistoryAddNote1710749867773 implements MigrationInterface { + name = 'UpdateTableProfileHistoryAddNote1710749867773' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` ADD \`note\` varchar(255) NULL COMMENT 'หมายเหตุ'`); + await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` ADD \`note\` varchar(255) NULL COMMENT 'หมายเหตุ'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` DROP COLUMN \`note\``); + await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` DROP COLUMN \`note\``); + } + +}