user request data

This commit is contained in:
kittapath 2024-09-30 17:56:49 +07:00
parent 939ed6ddfd
commit d899039b9d
9 changed files with 688 additions and 6 deletions

View file

@ -0,0 +1,139 @@
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { DevelopmentProject } from "./DevelopmentProject";
@Entity("developmentRequest")
export class DevelopmentRequest extends EntityBase {
//PENDING รอดำเนินการ
//APPROVE อนุมัติ
//REJECT ไม่อนุมัติ
@Column({
nullable: true,
comment: "สถานะ",
default: null,
})
status: string;
@Column({
nullable: true,
comment: "หมายเหตุ",
default: null,
})
reason: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง Profile",
default: null,
})
profileId: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
default: null,
})
profileEmployeeId: string;
@Column({
nullable: true,
comment: "ชื่อเรื่อง",
default: null,
})
name: string;
@Column({
comment: "วิธีพัฒนา70",
default: false,
})
isDevelopment70: boolean;
@Column({
comment: "วิธีพัฒนา20",
default: false,
})
isDevelopment20: boolean;
@Column({
comment: "วิธีพัฒนา10",
default: false,
})
isDevelopment10: boolean;
@Column({
nullable: true,
comment: "รายละเอียดอื่นๆ 70 แผน",
default: null,
})
reasonDevelopment70: string;
@Column({
nullable: true,
comment: "รายละเอียดอื่นๆ 20 แผน",
default: null,
})
reasonDevelopment20: string;
@Column({
nullable: true,
comment: "รายละเอียดอื่นๆ 10 แผน",
default: null,
})
reasonDevelopment10: string;
@Column({
nullable: true,
comment: "เป้าหมายการนำไปพัฒนางาน",
length: 255,
default: null,
})
developmentTarget: string;
@Column({
nullable: true,
comment: "วิธีการวัดผลการพัฒนา",
length: 255,
default: null,
})
developmentResults: string;
@Column({
nullable: true,
comment: "รายงานผลการพัฒนา",
length: 255,
default: null,
})
developmentReport: string;
@ManyToOne(() => Profile, (profile) => profile.developmentRequests)
@JoinColumn({ name: "profileId" })
profile: Profile;
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.developmentRequests)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
@OneToMany(
() => DevelopmentProject,
(developmentProject) => developmentProject.developmentRequest,
)
developmentProjects: DevelopmentProject[];
}
export class CreateDevelopmentRequest {
name: string | null;
developmentTarget: string | null;
developmentResults: string | null;
developmentReport: string | null;
reasonDevelopment70?: string | null;
reasonDevelopment20?: string | null;
reasonDevelopment10?: string | null;
isDevelopment70: boolean | null;
isDevelopment20: boolean | null;
isDevelopment10: boolean | null;
developmentProjects?: string[];
}

View file

@ -33,6 +33,7 @@ import { OrgRoot } from "./OrgRoot";
import { PermissionOrg } from "./PermissionOrg";
import { CommandSend } from "./CommandSend";
import { CommandRecive } from "./CommandRecive";
import { DevelopmentRequest } from "./DevelopmentRequest";
@Entity("profile")
export class Profile extends EntityBase {
@ -346,6 +347,9 @@ export class Profile extends EntityBase {
@OneToMany(() => ProfileDevelopment, (profileDevelopment) => profileDevelopment.profile)
profileDevelopments: ProfileDevelopment[];
@OneToMany(() => DevelopmentRequest, (developmentRequest) => developmentRequest.profile)
developmentRequests: DevelopmentRequest[];
@OneToMany(() => ProfileAvatar, (profileAvatar) => profileAvatar.profile)
profileAvatars: ProfileAvatar[];

View file

@ -3,9 +3,20 @@ import { EntityBase } from "./base/Base";
import { Profile } from "./Profile";
import { ProfileEmployee } from "./ProfileEmployee";
import { ProfileDevelopmentHistory } from "./ProfileDevelopmentHistory";
import { DevelopmentProject } from "./DevelopmentProject";
@Entity("profileDevelopment")
export class ProfileDevelopment extends EntityBase {
// REQUEST = ขอแก้ไข
// DEVELOP = พัฒนา
// KPI = ประเมิน
@Column({
nullable: true,
comment: "ระบบ",
default: null,
})
type: string;
@Column({
nullable: true,
length: 40,
@ -111,6 +122,30 @@ export class ProfileDevelopment extends EntityBase {
})
reasonDevelopment10: string;
@Column({
nullable: true,
comment: "เป้าหมายการนำไปพัฒนางาน",
length: 255,
default: null,
})
developmentTarget: string;
@Column({
nullable: true,
comment: "วิธีการวัดผลการพัฒนา",
length: 255,
default: null,
})
developmentResults: string;
@Column({
nullable: true,
comment: "รายงานผลการพัฒนา",
length: 255,
default: null,
})
developmentReport: string;
@Column({
nullable: true,
length: 40,
@ -132,9 +167,16 @@ export class ProfileDevelopment extends EntityBase {
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileDevelopments)
@JoinColumn({ name: "profileEmployeeId" })
profileEmployee: ProfileEmployee;
@OneToMany(
() => DevelopmentProject,
(developmentProject) => developmentProject.profileDevelopment,
)
developmentProjects: DevelopmentProject[];
}
export class CreateProfileDevelopment {
type?: string | null;
profileId: string | null;
name: string | null;
target: string | null;
@ -153,6 +195,7 @@ export class CreateProfileDevelopment {
}
export class CreateProfileEmployeeDevelopment {
type?: string | null;
profileEmployeeId: string | null;
name: string | null;
target: string | null;
@ -171,6 +214,7 @@ export class CreateProfileEmployeeDevelopment {
}
export type UpdateProfileDevelopment = {
type?: string | null;
name: string | null;
target: string | null;
achievement10?: string | null;

View file

@ -1,9 +1,20 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
import { EntityBase } from "./base/Base";
import { ProfileDevelopment } from "./ProfileDevelopment";
import { DevelopmentProject } from "./DevelopmentProject";
@Entity("profileDevelopmentHistory")
export class ProfileDevelopmentHistory extends EntityBase {
// REQUEST = ขอแก้ไข
// DEVELOP = พัฒนา
// KPI = ประเมิน
@Column({
nullable: true,
comment: "ระบบ",
default: null,
})
type: string;
@Column({
nullable: true,
comment: "ชื่อเรื่อง",
@ -93,6 +104,30 @@ export class ProfileDevelopmentHistory extends EntityBase {
})
reasonDevelopment10: string;
@Column({
nullable: true,
comment: "เป้าหมายการนำไปพัฒนางาน",
length: 255,
default: null,
})
developmentTarget: string;
@Column({
nullable: true,
comment: "วิธีการวัดผลการพัฒนา",
length: 255,
default: null,
})
developmentResults: string;
@Column({
nullable: true,
comment: "รายงานผลการพัฒนา",
length: 255,
default: null,
})
developmentReport: string;
@Column({
nullable: true,
length: 40,
@ -115,4 +150,10 @@ export class ProfileDevelopmentHistory extends EntityBase {
)
@JoinColumn({ name: "profileDevelopmentId" })
histories: ProfileDevelopment;
@OneToMany(
() => DevelopmentProject,
(developmentProject) => developmentProject.profileDevelopmentHistory,
)
developmentProjects: DevelopmentProject[];
}

View file

@ -32,6 +32,7 @@ import { ProfileEmployeeInformationHistory } from "./ProfileEmployeeInformationH
import { ProfileEmployeeEmployment } from "./ProfileEmployeeEmployment";
import { ProfileEdit } from "./ProfileEdit";
import { ProfileDevelopment } from "./ProfileDevelopment";
import { DevelopmentRequest } from "./DevelopmentRequest";
@Entity("profileEmployee")
export class ProfileEmployee extends EntityBase {
@ -630,6 +631,9 @@ export class ProfileEmployee extends EntityBase {
@OneToMany(() => ProfileDevelopment, (v) => v.profileEmployee)
profileDevelopments: ProfileDevelopment[];
@OneToMany(() => DevelopmentRequest, (v) => v.profileEmployee)
developmentRequests: DevelopmentRequest[];
@OneToMany(() => ProfileAvatar, (v) => v.profileEmployee)
profileAvatars: ProfileAvatar[];

View file

@ -1,5 +1,8 @@
import { Entity, Column } from "typeorm";
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { ProfileDevelopment } from "./ProfileDevelopment";
import { ProfileDevelopmentHistory } from "./ProfileDevelopmentHistory";
import { DevelopmentRequest } from "./DevelopmentRequest";
@Entity("developmentProject")
export class DevelopmentProject extends EntityBase {
@ -27,12 +30,40 @@ export class DevelopmentProject extends EntityBase {
})
profileDevelopmentId: string;
@ManyToOne(
() => ProfileDevelopment,
(profileDevelopment) => profileDevelopment.developmentProjects,
)
@JoinColumn({ name: "profileDevelopmentId" })
profileDevelopment: ProfileDevelopment;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
profileDevelopmentHistoryId: string;
@ManyToOne(
() => ProfileDevelopmentHistory,
(profileDevelopmentHistory) => profileDevelopmentHistory.developmentProjects,
)
@JoinColumn({ name: "profileDevelopmentHistoryId" })
profileDevelopmentHistory: ProfileDevelopmentHistory;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
developmentRequestId: string;
@ManyToOne(
() => DevelopmentRequest,
(developmentRequest) => developmentRequest.developmentProjects,
)
@JoinColumn({ name: "developmentRequestId" })
developmentRequest: DevelopmentRequest;
}
export class CreateDevelopmentProject {
@Column()