Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-03-18 17:54:27 +07:00
commit e64dbf20ce
27 changed files with 270 additions and 422 deletions

View file

@ -269,6 +269,7 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posDictName: Like(`%${keyword}%`) },
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
});
break;
@ -280,6 +281,7 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posTypeId: In(findEmpTypes.map((x) => x.id)) },
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
});
break;
@ -291,11 +293,13 @@ export class EmployeePositionController extends Controller {
findData = await this.employeePosDictRepository.find({
where: { posLevelId: In(findEmpLevels.map((x) => x.id)) },
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
});
} else {
//กรณีเลือกค้นหาจาก"ระดับชั้นงาน" แต่กรอกไม่ใช่ number ให้ปล่อยมาหมดเลย
findData = await this.employeePosDictRepository.find({
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
});
}
break;
@ -303,6 +307,7 @@ export class EmployeePositionController extends Controller {
default:
findData = await this.employeePosDictRepository.find({
relations: ["posType", "posLevel"],
order: { posLevel: { posLevelName: "ASC" } },
});
break;
}

View file

@ -159,7 +159,8 @@ export class PositionController extends Controller {
requestBody: CreatePosDictExe,
@Request() request: { user: Record<string, any> },
) {
let posDict: any;
// let posDict: PosDict;
let posDict: any = new PosDict();
posDict.posDictName = requestBody.posDictName;
posDict.posDictField = requestBody.posDictField;
posDict.posTypeId = requestBody.posTypeId;
@ -182,7 +183,7 @@ export class PositionController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล PosLevelId");
}
let posExecutive: any = null;
let posExecutive: any = new PosExecutive();
if (requestBody.posExecutive != null && requestBody.posExecutive != "") {
const checkName = await this.posExecutiveRepository.findOne({
where: { posExecutiveName: requestBody.posExecutive },
@ -192,8 +193,11 @@ export class PositionController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
}
posExecutive.posExecutiveName = requestBody.posExecutive;
const checkPriority = await this.posExecutiveRepository.findOne({
select: ["posExecutivePriority"],
where: {
posExecutivePriority: Not(IsNull()),
},
order: { posExecutivePriority: "DESC" },
});
if (checkPriority == null) {

View file

@ -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",

View file

@ -77,6 +77,7 @@ export class ProfileHonorController extends Controller {
issuer: "issuer",
refCommandDate: "2024-03-12T10:10:31.000Z",
refCommandNo: "refCommandNo",
isDate: true,
profileHonorId: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
},
{
@ -93,6 +94,7 @@ export class ProfileHonorController extends Controller {
issuer: "string",
refCommandDate: "2024-03-12T10:09:47.000Z",
refCommandNo: "string",
isDate: true,
profileHonorId: "debfa8a7-83fb-4801-a940-8ae74e7638d3",
},
],

View file

@ -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",
},
],

View file

@ -91,6 +91,7 @@ export class ProfileTrainingController extends Controller {
duration: "string",
name: "string",
yearly: 0,
isDate: true,
profileTrainingId: "3cf02fb7-2f0c-471b-b641-51d557375c0a",
},
{
@ -112,6 +113,7 @@ export class ProfileTrainingController extends Controller {
duration: "string",
name: "name",
yearly: 0,
isDate: true,
profileTrainingId: "3cf02fb7-2f0c-471b-b641-51d557375c0a",
},
],

View file

@ -18,7 +18,7 @@ export class ProfileAbility extends EntityBase {
default: false,
})
isActive: boolean;
@Column({
nullable: true,
comment: "หมายเหตุ",
@ -67,7 +67,10 @@ export class ProfileAbility extends EntityBase {
})
field: string;
@OneToMany(() => ProfileAbilityHistory, (profileAbilityHistory) => profileAbilityHistory.histories)
@OneToMany(
() => ProfileAbilityHistory,
(profileAbilityHistory) => profileAbilityHistory.histories,
)
profileAbilityHistorys: ProfileAbilityHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileAbilities)
@ -76,29 +79,23 @@ export class ProfileAbility extends EntityBase {
}
export class CreateProfileAbility {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
remark: string | null;
@Column()
detail: string | null;
@Column()
reference: string | null;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
@Column()
field: string | null;
}
export type UpdateProfileAbility = Partial<CreateProfileAbility>;
export type UpdateProfileAbility = {
profileId: string | null;
isActive: boolean;
remark: string | null;
detail: string | null;
reference: string | null;
dateStart?: Date | null;
dateEnd?: Date | null;
field: string | null;
};

View file

@ -5,13 +5,12 @@ import { ProfileAbility } from "./ProfileAbility";
@Entity("profileAbilityHistory")
export class ProfileAbilityHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
})
isActive: boolean;
@Column({
nullable: true,
comment: "หมายเหตุ",
@ -72,32 +71,3 @@ export class ProfileAbilityHistory extends EntityBase {
@JoinColumn({ name: "profileAbilityId" })
histories: ProfileAbility;
}
export class CreateProfileAbilityHistory {
@Column()
isActive: boolean;
@Column()
remark: string | null;
@Column()
detail: string | null;
@Column()
reference: string | null;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
@Column()
field: string | null;
@Column("uuid")
ProfileAbilityId: string | null;
}
export type UpdateProfileAbilityHistory = Partial<CreateProfileAbilityHistory>;

View file

@ -22,11 +22,11 @@ export class ProfileAssessment extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อแบบประเมิน",
type: "text",
type: "text",
default: null,
})
name: string;
@Column({
nullable: true,
type: "datetime",
@ -83,7 +83,10 @@ export class ProfileAssessment extends EntityBase {
})
pointSumTotal: number;
@OneToMany(() => ProfileAssessmentHistory, (profileAssessmentHistory) => profileAssessmentHistory.histories)
@OneToMany(
() => ProfileAssessmentHistory,
(profileAssessmentHistory) => profileAssessmentHistory.histories,
)
profileAssessmentHistorys: ProfileAssessmentHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileAssessments)
@ -92,35 +95,27 @@ export class ProfileAssessment extends EntityBase {
}
export class CreateProfileAssessment {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
name: string | null;
@Column()
date: Date | null;
@Column()
point1: number | null;
@Column()
point1Total: number | null;
@Column()
point2: number | null;
@Column()
point2Total: number | null;
@Column()
pointSum: number | null;
@Column()
pointSumTotal: number | null;
}
export type UpdateProfileAssessment = Partial<CreateProfileAssessment>;
export type UpdateProfileAssessment = {
profileId: string | null;
isActive: boolean;
name: string | null;
date?: Date | null;
point1: number | null;
point1Total: number | null;
point2: number | null;
point2Total: number | null;
pointSum: number | null;
pointSumTotal: number | null;
};

View file

@ -5,7 +5,6 @@ import { ProfileAssessment } from "./ProfileAssessment";
@Entity("profileAssessmentHistory")
export class ProfileAssessmentHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
@ -15,11 +14,11 @@ export class ProfileAssessmentHistory extends EntityBase {
@Column({
nullable: true,
comment: "ชื่อแบบประเมิน",
type: "text",
type: "text",
default: null,
})
name: string;
@Column({
nullable: true,
type: "datetime",
@ -83,43 +82,11 @@ export class ProfileAssessmentHistory extends EntityBase {
default: null,
})
profileAssessmentId: string;
@ManyToOne(() => ProfileAssessment, (profileAssessment) => profileAssessment.profileAssessmentHistorys)
@ManyToOne(
() => ProfileAssessment,
(profileAssessment) => profileAssessment.profileAssessmentHistorys,
)
@JoinColumn({ name: "profileAssessmentId" })
histories: ProfileAssessment;
}
export class CreateProfileAssessmentHistory {
@Column()
isActive: boolean;
@Column()
name: string | null;
@Column()
date: Date | null;
@Column()
point1: number | null;
@Column()
point1Total: number | null;
@Column()
point2: number | null;
@Column()
point2Total: number | null;
@Column()
pointSum: number | null;
@Column()
pointSumTotal: number | null;
@Column("uuid")
profileAssessmentId: string | null;
}
export type UpdateProfileAssessmentHistory = Partial<CreateProfileAssessmentHistory>;

View file

@ -41,7 +41,7 @@ export class ProfileDiscipline extends EntityBase {
default: null,
})
detail: string;
@Column({
nullable: true,
type: "datetime",
@ -66,7 +66,10 @@ export class ProfileDiscipline extends EntityBase {
})
unStigma: string;
@OneToMany(() => ProfileDisciplineHistory, (profileDisciplineHistory) => profileDisciplineHistory.histories)
@OneToMany(
() => ProfileDisciplineHistory,
(profileDisciplineHistory) => profileDisciplineHistory.histories,
)
profileDisciplineHistories: ProfileDisciplineHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileDiscipline)
@ -75,30 +78,23 @@ export class ProfileDiscipline extends EntityBase {
}
export class CreateProfileDiscipline {
@Column()
date: Date | null;
@Column()
profileId: string;
@Column()
isActive: boolean | null;
@Column()
level: string | null;
@Column()
level: string | null;
detail: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
@Column()
unStigma: string | null;
}
export type UpdateProfileDiscipline = Partial<CreateProfileDiscipline>;
export type UpdateProfileDiscipline = {
date?: Date | null;
profileId: string;
isActive: boolean | null;
level: string | null;
detail: string | null;
refCommandDate?: Date | null;
refCommandNo: string | null;
unStigma: string | null;
};

View file

@ -76,29 +76,23 @@ export class ProfileDuty extends EntityBase {
}
export class CreateProfileDuty {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
@Column()
detail: string | null;
@Column()
reference: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
}
export type UpdateProfileDuty = Partial<CreateProfileDuty>;
export type UpdateProfileDuty = {
profileId: string | null;
isActive: boolean;
dateStart?: Date | null;
dateEnd?: Date | null;
detail: string | null;
reference: string | null;
refCommandDate?: Date | null;
refCommandNo: string | null;
};

View file

@ -5,7 +5,6 @@ import { ProfileDuty } from "./ProfileDuty";
@Entity("profileDutyHistory")
export class ProfileDutyHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
@ -68,37 +67,7 @@ export class ProfileDutyHistory extends EntityBase {
})
profileDutyId: string;
@ManyToOne(() => ProfileDuty, (profileDuty) => profileDuty.profileDutyHistories)
@JoinColumn({ name: "profileDutyId" })
histories: ProfileDuty;
}
export class CreateProfileDutyHistory {
@Column()
isActive: boolean;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
@Column()
detail: string | null;
@Column()
reference: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
@Column("uuid")
profileDutyId: string | null;
}
export type UpdateProfileDutyHistory = Partial<CreateProfileDutyHistory>;

View file

@ -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 {
@ -234,6 +236,9 @@ export class CreateProfileEducation {
@Column()
isEducation: boolean | null;
@Column()
note: string | null;
}
export type UpdateProfileEducation = Partial<CreateProfileEducation>;

View file

@ -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<CreateProfileEducationHistory>;

View file

@ -5,7 +5,6 @@ import { ProfileHonor } from "./ProfileHonor";
@Entity("profileHonorHistory")
export class ProfileHonorHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
@ -60,13 +59,19 @@ export class ProfileHonorHistory extends EntityBase {
})
profileHonorId: string;
@Column({
nullable: true,
comment: "ประเภทช่วงเวลาการศึกษา",
default: null,
})
isDate: boolean;
@ManyToOne(() => ProfileHonor, (profileHonor) => profileHonor.profileHonorHistories)
@JoinColumn({ name: "profileHonorId" })
histories: ProfileHonor;
}
export class CreateProfileHonorHistory {
@Column()
isActive: boolean;
@ -80,11 +85,14 @@ export class CreateProfileHonorHistory {
issuer: string | null;
@Column()
refCommandDate: Date | null;
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
@Column()
isDate: boolean | null;
@Column("uuid")
profileHonorId: string | null;
}

View file

@ -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;
@ -180,6 +183,9 @@ export class CreateProfileInsignia {
@Column()
refCommandNo: string | null;
@Column()
note: string | null;
}
export type UpdateProfileInsignia = Partial<CreateProfileInsignia>;

View file

@ -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;
}

View file

@ -259,7 +259,7 @@ export class ProfileLeave extends EntityBase {
})
typeLeaveId: string;
@Column({
@Column({
nullable: true,
comment: "เหตุผล",
type: "text",
@ -276,104 +276,73 @@ export class ProfileLeave extends EntityBase {
}
export class CreateProfileLeave {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
restCount: number | null;
@Column()
restDay: number | null;
@Column()
sickCount: number | null;
@Column()
sickDay: number | null;
@Column()
otherDay: number | null;
@Column()
personalCount: number | null;
@Column()
personalDay: number | null;
@Column()
studyCount: number | null;
@Column()
absentCount: number | null;
@Column()
absentDay: number | null;
@Column()
agencyCount: number | null;
@Column()
agencyDay: number | null;
@Column()
agencyDay: number | null;
coupleCount: number | null;
@Column()
coupleDay: number | null;
@Column()
lateCount: number | null;
@Column()
lateDay: number | null;
@Column()
maternityCount: number | null;
@Column()
maternityDay: number | null;
@Column()
militaryCount: number | null;
@Column()
militaryDay: number | null;
@Column()
ordainCount: number | null;
@Column()
ordainDay: number | null;
@Column()
otherCount: number | null;
@Column()
dateStartLeave: Date | null;
@Column()
dateEndLeave: Date | null;
@Column()
numLeave: number | null;
@Column()
sumLeave: number | null;
@Column()
totalLeave: number | null;
@Column()
status: string | null;
@Column("uuid")
typeLeaveId: string | null;
@Column()
reason: string | null;
}
export type UpdateProfileLeave = Partial<CreateProfileLeave>;
export type UpdateProfileLeave = {
profileId: string | null;
isActive: boolean;
restCount: number | null;
restDay: number | null;
sickCount: number | null;
sickDay: number | null;
otherDay: number | null;
personalCount: number | null;
personalDay: number | null;
studyCount: number | null;
absentCount: number | null;
absentDay: number | null;
agencyCount: number | null;
agencyDay: number | null;
coupleCount: number | null;
coupleDay: number | null;
lateCount: number | null;
lateDay: number | null;
maternityCount: number | null;
maternityDay: number | null;
militaryCount: number | null;
militaryDay: number | null;
ordainCount: number | null;
ordainDay: number | null;
otherCount: number | null;
dateStartLeave?: Date | null;
dateEndLeave?: Date | null;
numLeave: number | null;
sumLeave: number | null;
totalLeave: number | null;
status: string | null;
typeLeaveId: string | null;
reason: string | null;
};

View file

@ -68,27 +68,21 @@ export class ProfileNopaid extends EntityBase {
}
export class CreateProfileNopaid {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
date: Date | null;
@Column()
detail: string | null;
@Column()
reference: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
}
export type UpdateProfileNopaid = Partial<CreateProfileNopaid>;
export type UpdateProfileNopaid = {
profileId: string | null;
isActive: boolean;
date?: Date | null;
detail: string | null;
reference: string | null;
refCommandDate?: Date | null;
refCommandNo: string | null;
};

View file

@ -5,7 +5,6 @@ import { ProfileNopaid } from "./ProfileNopaid";
@Entity("profileNopaidHistory")
export class ProfileNopaidHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
@ -60,35 +59,7 @@ export class ProfileNopaidHistory extends EntityBase {
})
profileNopaidId: string;
@ManyToOne(() => ProfileNopaid, (profileNopaid) => profileNopaid.profileNopaidHistories)
@JoinColumn({ name: "profileNopaidId" })
histories: ProfileNopaid;
}
export class CreateProfileNopaidHistory {
@Column()
isActive: boolean;
@Column()
date: Date | null;
@Column()
detail: string | null;
@Column()
reference: string | null;
@Column()
refCommandDate: Date | null;
@Column()
refCommandNo: string | null;
@Column("uuid")
profileNopaidId: string | null;
}
export type UpdateProfileNopaidHistory = Partial<CreateProfileNopaidHistory>;

View file

@ -18,7 +18,7 @@ export class ProfileOther extends EntityBase {
default: false,
})
isActive: boolean;
@Column({
nullable: true,
comment: "รายละเอียด",
@ -44,17 +44,15 @@ export class ProfileOther extends EntityBase {
}
export class CreateProfileOther {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
detail: string | null;
@Column()
date: Date | null;
}
export type UpdateProfileOther = Partial<CreateProfileOther>;
export type UpdateProfileOther = {
profileId: string | null;
isActive: boolean;
detail: string | null;
date?: Date | null;
};

View file

@ -17,7 +17,7 @@ export class ProfileOtherHistory extends EntityBase {
default: false,
})
isActive: boolean;
@Column({
nullable: true,
comment: "รายละเอียด",
@ -38,19 +38,3 @@ export class ProfileOtherHistory extends EntityBase {
@JoinColumn({ name: "profileOtherId" })
histories: ProfileOther;
}
export class CreateProfileOtherHistory {
@Column("uuid")
profileOtherId: string | null;
@Column()
isActive: boolean;
@Column()
detail: string | null;
@Column()
date: Date | null;
}
export type UpdateProfileOtherHistory = Partial<CreateProfileOtherHistory>;

View file

@ -104,8 +104,11 @@ export class ProfileTraining extends EntityBase {
default: null,
})
isDate: boolean;
@OneToMany(() => ProfileTrainingHistory, (profileTrainingHistory) => profileTrainingHistory.histories)
@OneToMany(
() => ProfileTrainingHistory,
(profileTrainingHistory) => profileTrainingHistory.histories,
)
profileTrainingHistories: ProfileTrainingHistory[];
@ManyToOne(() => Profile, (profile) => profile.profileTrainings)
@ -114,44 +117,33 @@ export class ProfileTraining extends EntityBase {
}
export class CreateProfileTraining {
@Column("uuid")
profileId: string | null;
@Column()
isActive: boolean;
@Column()
startDate: Date | null;
@Column()
endDate: Date | null;
@Column()
numberOrder: string | null;
@Column()
numberOrder: string | null;
topic: string | null;
@Column()
place: string | null;
@Column()
dateOrder: Date | null;
@Column()
department: string | null;
@Column()
duration: string | null;
@Column()
name: string | null;
@Column()
yearly: number | null;
@Column()
isDate: boolean | null;
}
export type UpdateProfileTraining = Partial<CreateProfileTraining>;
export type UpdateProfileTraining = {
profileId: string | null;
isActive: boolean;
startDate?: Date | null;
endDate?: Date | null;
numberOrder: string | null;
topic: string | null;
place: string | null;
dateOrder?: Date | null;
department: string | null;
duration: string | null;
name: string | null;
yearly: number | null;
isDate: boolean | null;
};

View file

@ -5,7 +5,6 @@ import { ProfileTraining } from "./ProfileTraining";
@Entity("profileTrainingHistory")
export class ProfileTrainingHistory extends EntityBase {
@Column({
comment: "สถานะการใช้งาน",
default: false,
@ -98,49 +97,15 @@ export class ProfileTrainingHistory extends EntityBase {
default: null,
})
profileTrainingId: string;
@Column({
nullable: true,
comment: "ประเภทช่วงเวลาการศึกษา",
default: null,
})
isDate: boolean;
@ManyToOne(() => ProfileTraining, (profileTraining) => profileTraining.profileTrainingHistories)
@JoinColumn({ name: "profileTrainingId" })
histories: ProfileTraining;
}
export class CreateProfileTrainingHistory {
@Column()
isActive: boolean;
@Column()
startDate: Date | null;
@Column()
endDate: Date | null;
@Column()
numberOrder: string | null;
@Column()
topic: string | null;
@Column()
place: string | null;
@Column()
dateOrder: Date | null;
@Column()
department: string | null;
@Column()
duration: string | null;
@Column()
name: string | null;
@Column()
yearly: number | null;
@Column("uuid")
profileTrainingId: string | null;
}
export type UpdateProfileTrainingHistory = Partial<CreateProfileTrainingHistory>;

View file

@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileHistoryAddNote1710749867773 implements MigrationInterface {
name = 'UpdateTableProfileHistoryAddNote1710749867773'
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.query(`ALTER TABLE \`profileInsigniaHistory\` DROP COLUMN \`note\``);
await queryRunner.query(`ALTER TABLE \`profileEducationHistory\` DROP COLUMN \`note\``);
}
}

View file

@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileHistoryAddIsDate1710752446531 implements MigrationInterface {
name = 'UpdateTableProfileHistoryAddIsDate1710752446531'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` ADD \`isDate\` tinyint NULL COMMENT 'ประเภทช่วงเวลาการศึกษา'`);
await queryRunner.query(`ALTER TABLE \`profileTrainingHistory\` ADD \`isDate\` tinyint NULL COMMENT 'ประเภทช่วงเวลาการศึกษา'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileTrainingHistory\` DROP COLUMN \`isDate\``);
await queryRunner.query(`ALTER TABLE \`profileHonorHistory\` DROP COLUMN \`isDate\``);
}
}