no message
This commit is contained in:
parent
5a688215e7
commit
8382335f24
5 changed files with 440 additions and 282 deletions
|
|
@ -19,7 +19,11 @@ import HttpError from "../interfaces/http-error";
|
|||
import { ProfileDevelopmentHistory } from "../entities/ProfileDevelopmentHistory";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Profile } from "../entities/Profile";
|
||||
import { CreateProfileDevelopment, ProfileDevelopment, UpdateProfileDevelopment } from "../entities/ProfileDevelopment";
|
||||
import {
|
||||
CreateProfileDevelopment,
|
||||
ProfileDevelopment,
|
||||
UpdateProfileDevelopment,
|
||||
} from "../entities/ProfileDevelopment";
|
||||
import permission from "../interfaces/permission";
|
||||
import { DevelopmentProject } from "../entities/developmentProject";
|
||||
@Route("api/v1/org/profile/development")
|
||||
|
|
@ -39,6 +43,7 @@ export class ProfileDevelopmentController extends Controller {
|
|||
}
|
||||
const lists = await this.developmentRepository.find({
|
||||
where: { profileId: profile.id },
|
||||
relations: ["developmentProjects"],
|
||||
});
|
||||
return new HttpSuccess(lists);
|
||||
}
|
||||
|
|
@ -63,6 +68,7 @@ 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"],
|
||||
});
|
||||
return new HttpSuccess(lists);
|
||||
}
|
||||
|
|
@ -93,17 +99,21 @@ export class ProfileDevelopmentController extends Controller {
|
|||
}
|
||||
const record = await this.developmentHistoryRepository.find({
|
||||
where: { profileDevelopmentId: developmentId },
|
||||
relations: ["developmentHistoryProjects"],
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Post()
|
||||
public async newDevelopment(@Request() req: RequestWithUser, @Body() body: CreateProfileDevelopment) {
|
||||
public async newDevelopment(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileDevelopment,
|
||||
) {
|
||||
if (!body.profileId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
||||
|
||||
const profile = await this.profileRepository.findOneBy({ id: body.profileId });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -128,27 +138,27 @@ export class ProfileDevelopmentController extends Controller {
|
|||
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);
|
||||
}),
|
||||
);
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
@ -158,8 +168,10 @@ export class ProfileDevelopmentController extends Controller {
|
|||
@Body() body: UpdateProfileDevelopment,
|
||||
@Path() developmentId: string,
|
||||
) {
|
||||
const record = await this.developmentRepository.findOne({ where:{id: developmentId},
|
||||
relations: ["developmentProjects"], });
|
||||
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);
|
||||
|
||||
|
|
@ -183,39 +195,45 @@ export class ProfileDevelopmentController extends Controller {
|
|||
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);
|
||||
}),
|
||||
);
|
||||
}
|
||||
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();
|
||||
}
|
||||
|
||||
@Delete("{developmentId}")
|
||||
public async deleteDevelopment(@Path() developmentId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.developmentRepository.findOneBy({ id: developmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_OFFICER", _record.profileId);
|
||||
}
|
||||
await this.developmentProjectRepository.delete({profileDevelopmentId:developmentId});
|
||||
await this.developmentProjectRepository.delete({profileDevelopmentHistory:{profileDevelopmentId:developmentId}});
|
||||
const _record = await this.developmentRepository.findOneBy({ id: developmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
req,
|
||||
"SYS_REGISTRY_OFFICER",
|
||||
_record.profileId,
|
||||
);
|
||||
}
|
||||
await this.developmentProjectRepository.delete({ profileDevelopmentId: developmentId });
|
||||
await this.developmentProjectRepository.delete({
|
||||
profileDevelopmentHistory: { profileDevelopmentId: developmentId },
|
||||
});
|
||||
await this.developmentHistoryRepository.delete({
|
||||
profileDevelopmentId: developmentId,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ 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")
|
||||
|
|
@ -32,6 +33,7 @@ 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) {
|
||||
|
|
@ -41,6 +43,7 @@ export class ProfileDevelopmentEmployeeController extends Controller {
|
|||
}
|
||||
const lists = await this.developmentRepository.find({
|
||||
where: { profileEmployeeId: profile.id },
|
||||
relations: ["developmentProjects"],
|
||||
});
|
||||
return new HttpSuccess(lists);
|
||||
}
|
||||
|
|
@ -50,6 +53,7 @@ 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);
|
||||
}
|
||||
|
|
@ -58,17 +62,25 @@ export class ProfileDevelopmentEmployeeController extends Controller {
|
|||
public async developmentHistory(@Path() developmentId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.developmentRepository.findOneBy({ id: developmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_EMP", _record.profileEmployeeId);
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
const record = await this.developmentHistoryRepository.find({
|
||||
where: { profileDevelopmentId: developmentId },
|
||||
relations: ["developmentHistoryProjects"],
|
||||
order: { createdAt: "DESC" },
|
||||
});
|
||||
return new HttpSuccess(record);
|
||||
}
|
||||
|
||||
@Post()
|
||||
public async newDevelopment(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDevelopment) {
|
||||
public async newDevelopment(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeDevelopment,
|
||||
) {
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
}
|
||||
|
|
@ -96,6 +108,28 @@ 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();
|
||||
}
|
||||
|
||||
|
|
@ -105,10 +139,16 @@ export class ProfileDevelopmentEmployeeController extends Controller {
|
|||
@Body() body: UpdateProfileDevelopment,
|
||||
@Path() developmentId: string,
|
||||
) {
|
||||
|
||||
const record = await this.developmentRepository.findOneBy({ id: developmentId });
|
||||
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_EMP", record.profileEmployeeId)
|
||||
await new permission().PermissionOrgUserUpdate(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
record.profileEmployeeId,
|
||||
);
|
||||
|
||||
const history = new ProfileDevelopmentHistory();
|
||||
|
||||
|
|
@ -127,6 +167,30 @@ 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();
|
||||
}
|
||||
|
|
@ -135,8 +199,16 @@ export class ProfileDevelopmentEmployeeController extends Controller {
|
|||
public async deleteDevelopment(@Path() developmentId: string, @Request() req: RequestWithUser) {
|
||||
const _record = await this.developmentRepository.findOneBy({ id: developmentId });
|
||||
if (_record) {
|
||||
await new permission().PermissionOrgUserDelete(req, "SYS_REGISTRY_EMP", _record.profileEmployeeId);
|
||||
await new permission().PermissionOrgUserDelete(
|
||||
req,
|
||||
"SYS_REGISTRY_EMP",
|
||||
_record.profileEmployeeId,
|
||||
);
|
||||
}
|
||||
await this.developmentProjectRepository.delete({ profileDevelopmentId: developmentId });
|
||||
await this.developmentProjectRepository.delete({
|
||||
profileDevelopmentHistory: { profileDevelopmentId: developmentId },
|
||||
});
|
||||
|
||||
await this.developmentHistoryRepository.delete({
|
||||
profileDevelopmentId: developmentId,
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ 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")
|
||||
|
|
@ -32,6 +33,7 @@ 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> }) {
|
||||
|
|
@ -41,6 +43,7 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
|
|||
}
|
||||
const lists = await this.developmentRepository.find({
|
||||
where: { profileEmployeeId: profile.id },
|
||||
relations: ["developmentProjects"],
|
||||
});
|
||||
return new HttpSuccess(lists);
|
||||
}
|
||||
|
|
@ -50,6 +53,7 @@ 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);
|
||||
}
|
||||
|
|
@ -59,13 +63,17 @@ 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);
|
||||
}
|
||||
|
||||
@Post()
|
||||
public async newDevelopment(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeDevelopment) {
|
||||
public async newDevelopment(
|
||||
@Request() req: RequestWithUser,
|
||||
@Body() body: CreateProfileEmployeeDevelopment,
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_REGISTRY_TEMP");
|
||||
if (!body.profileEmployeeId) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||
|
|
@ -94,6 +102,28 @@ 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();
|
||||
}
|
||||
|
||||
|
|
@ -104,7 +134,10 @@ export class ProfileDevelopmentEmployeeTempController extends Controller {
|
|||
@Path() developmentId: string,
|
||||
) {
|
||||
await new permission().PermissionUpdate(req, "SYS_REGISTRY_TEMP");
|
||||
const record = await this.developmentRepository.findOneBy({ id: developmentId });
|
||||
const record = await this.developmentRepository.findOne({
|
||||
where: { id: developmentId },
|
||||
relations: ["developmentProjects"],
|
||||
});
|
||||
|
||||
if (!record) throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
||||
|
|
@ -125,6 +158,30 @@ 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();
|
||||
}
|
||||
|
|
@ -132,6 +189,10 @@ 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,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -7,118 +7,121 @@ import { DevelopmentProject } from "./developmentProject";
|
|||
|
||||
@Entity("profileDevelopment")
|
||||
export class ProfileDevelopment extends EntityBase {
|
||||
@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({
|
||||
nullable: true,
|
||||
comment: "เป้าหมาย",
|
||||
default: null,
|
||||
})
|
||||
target: string;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ผลการประเมิน",
|
||||
})
|
||||
summary: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับคะแนน",
|
||||
default: null,
|
||||
})
|
||||
point: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 10",
|
||||
default: null,
|
||||
})
|
||||
achievement10: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 5",
|
||||
default: null,
|
||||
})
|
||||
achievement5: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 0",
|
||||
default: null,
|
||||
})
|
||||
achievement0: 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;
|
||||
|
||||
@OneToMany(
|
||||
() => DevelopmentProject,
|
||||
(developmentProject: DevelopmentProject) => developmentProject.profileDevelopment,
|
||||
)
|
||||
developmentProjects: DevelopmentProject[];
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง Profile",
|
||||
default: null,
|
||||
})
|
||||
profileId: string;
|
||||
|
||||
@OneToMany(() => ProfileDevelopmentHistory, (profileDevelopmentHistory) => profileDevelopmentHistory.histories)
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
comment: "คีย์นอก(FK)ของตาราง ProfileEmployee",
|
||||
default: null,
|
||||
})
|
||||
profileEmployeeId: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อเรื่อง",
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เป้าหมาย",
|
||||
default: null,
|
||||
})
|
||||
target: string;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ผลการประเมิน",
|
||||
})
|
||||
summary: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับคะแนน",
|
||||
default: null,
|
||||
})
|
||||
point: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 10",
|
||||
default: null,
|
||||
})
|
||||
achievement10: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 5",
|
||||
default: null,
|
||||
})
|
||||
achievement5: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 0",
|
||||
default: null,
|
||||
})
|
||||
achievement0: 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;
|
||||
|
||||
@OneToMany(
|
||||
() => DevelopmentProject,
|
||||
(developmentProject: DevelopmentProject) => developmentProject.profileDevelopment,
|
||||
)
|
||||
developmentProjects: DevelopmentProject[];
|
||||
|
||||
@OneToMany(
|
||||
() => ProfileDevelopmentHistory,
|
||||
(profileDevelopmentHistory) => profileDevelopmentHistory.histories,
|
||||
)
|
||||
profileDevelopmentHistories: ProfileDevelopmentHistory[];
|
||||
|
||||
@ManyToOne(() => Profile, (profile) => profile.profileDevelopments)
|
||||
|
|
@ -167,18 +170,18 @@ export class CreateProfileEmployeeDevelopment {
|
|||
}
|
||||
|
||||
export type UpdateProfileDevelopment = {
|
||||
name: string;
|
||||
target: string | null;
|
||||
achievement10?: string | null;
|
||||
achievement5?: string | null;
|
||||
achievement0?: string | null;
|
||||
developmentProjects?: string[];
|
||||
reasonDevelopment70?: string;
|
||||
reasonDevelopment20?: string;
|
||||
reasonDevelopment10?: string;
|
||||
isDevelopment70: boolean;
|
||||
isDevelopment20: boolean;
|
||||
isDevelopment10: boolean;
|
||||
summary?: number;
|
||||
point?: number;
|
||||
name: string;
|
||||
target: string | null;
|
||||
achievement10?: string | null;
|
||||
achievement5?: string | null;
|
||||
achievement0?: string | null;
|
||||
developmentProjects?: string[];
|
||||
reasonDevelopment70?: string;
|
||||
reasonDevelopment20?: string;
|
||||
reasonDevelopment10?: string;
|
||||
isDevelopment70: boolean;
|
||||
isDevelopment20: boolean;
|
||||
isDevelopment10: boolean;
|
||||
summary?: number;
|
||||
point?: number;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,101 +5,102 @@ import { DevelopmentProject } from "./developmentProject";
|
|||
|
||||
@Entity("profileDevelopmentHistory")
|
||||
export class ProfileDevelopmentHistory extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อเรื่อง",
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เป้าหมาย",
|
||||
default: null,
|
||||
})
|
||||
target: string;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ผลการประเมิน",
|
||||
})
|
||||
summary: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับคะแนน",
|
||||
default: null,
|
||||
})
|
||||
point: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 10",
|
||||
default: null,
|
||||
})
|
||||
achievement10: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 5",
|
||||
default: null,
|
||||
})
|
||||
achievement5: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 0",
|
||||
default: null,
|
||||
})
|
||||
achievement0: 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;
|
||||
|
||||
@OneToMany(
|
||||
() => DevelopmentProject,
|
||||
(developmentHistoryProject: DevelopmentProject) => developmentHistoryProject.profileDevelopmentHistory,
|
||||
)
|
||||
developmentHistoryProjects: DevelopmentProject[];
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ชื่อเรื่อง",
|
||||
default: null,
|
||||
})
|
||||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เป้าหมาย",
|
||||
default: null,
|
||||
})
|
||||
target: string;
|
||||
|
||||
@Column({
|
||||
type: "double",
|
||||
nullable: true,
|
||||
default: null,
|
||||
comment: "ผลการประเมิน",
|
||||
})
|
||||
summary: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับคะแนน",
|
||||
default: null,
|
||||
})
|
||||
point: number;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 10",
|
||||
default: null,
|
||||
})
|
||||
achievement10: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 5",
|
||||
default: null,
|
||||
})
|
||||
achievement5: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "เกณฑ์การประเมิน 0",
|
||||
default: null,
|
||||
})
|
||||
achievement0: 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;
|
||||
|
||||
@OneToMany(
|
||||
() => DevelopmentProject,
|
||||
(developmentHistoryProject: DevelopmentProject) =>
|
||||
developmentHistoryProject.profileDevelopmentHistory,
|
||||
)
|
||||
developmentHistoryProjects: DevelopmentProject[];
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
length: 40,
|
||||
|
|
@ -108,7 +109,10 @@ export class ProfileDevelopmentHistory extends EntityBase {
|
|||
})
|
||||
profileDevelopmentId: string;
|
||||
|
||||
@ManyToOne(() => ProfileDevelopment, (profileDevelopment) => profileDevelopment.profileDevelopmentHistories)
|
||||
@ManyToOne(
|
||||
() => ProfileDevelopment,
|
||||
(profileDevelopment) => profileDevelopment.profileDevelopmentHistories,
|
||||
)
|
||||
@JoinColumn({ name: "profileDevelopmentId" })
|
||||
histories: ProfileDevelopment;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue