Merge branch 'develop' into adiDev
This commit is contained in:
commit
546f3330b2
9 changed files with 589 additions and 349 deletions
|
|
@ -34,6 +34,13 @@ export class PermissionController extends Controller {
|
|||
|
||||
@Get("")
|
||||
public async getPermission(@Request() request: { user: Record<string, any> }) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const redisClient = await this.redis.createClient({
|
||||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
|
|
@ -64,10 +71,11 @@ export class PermissionController extends Controller {
|
|||
select: ["authRoleId"],
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -75,10 +83,11 @@ export class PermissionController extends Controller {
|
|||
select: ["authRoleId"],
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -292,6 +301,13 @@ export class PermissionController extends Controller {
|
|||
|
||||
@Get("org")
|
||||
public async listAuthSysOrg(@Request() request: RequestWithUser) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const redisClient = await this.redis.createClient({
|
||||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
|
|
@ -322,10 +338,11 @@ export class PermissionController extends Controller {
|
|||
const posMaster = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -350,10 +367,11 @@ export class PermissionController extends Controller {
|
|||
const posMaster = await this.posMasterEmpRepository.findOne({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -382,6 +400,13 @@ export class PermissionController extends Controller {
|
|||
|
||||
@Get("user/{id}")
|
||||
public async listOrgUser(@Request() request: RequestWithUser, @Path() id: string) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const redisClient = await this.redis.createClient({
|
||||
host: REDIS_HOST,
|
||||
port: REDIS_PORT,
|
||||
|
|
@ -412,10 +437,11 @@ export class PermissionController extends Controller {
|
|||
const posMaster = await this.posMasterRepository.findOne({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
@ -440,10 +466,11 @@ export class PermissionController extends Controller {
|
|||
const posMaster = await this.posMasterEmpRepository.findOne({
|
||||
where: {
|
||||
current_holderId: profile.id,
|
||||
orgRevision: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsDraft: false,
|
||||
// orgRevisionIsCurrent: true,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id
|
||||
},
|
||||
});
|
||||
if (!posMaster) {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import { Position } from "../entities/Position";
|
|||
import { PosMaster } from "../entities/PosMaster";
|
||||
import { calculateAge, calculateRetireDate } from "../interfaces/utils";
|
||||
import permission from "../interfaces/permission";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
@Route("api/v1/org/profile/government")
|
||||
@Tags("ProfileGovernment")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -18,7 +19,7 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
private govRepo = AppDataSource.getRepository(ProfileGovernment);
|
||||
private positionRepo = AppDataSource.getRepository(Position);
|
||||
private posMasterRepo = AppDataSource.getRepository(PosMaster);
|
||||
|
||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||
/**
|
||||
*
|
||||
* @summary ข้อมูลราชการ
|
||||
|
|
@ -26,6 +27,13 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
*/
|
||||
@Get("user")
|
||||
public async getGovHistoryUser(@Request() request: { user: Record<string, any> }) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const profile = await this.profileRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -39,10 +47,11 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
});
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profile.id,
|
||||
},
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
@ -58,10 +67,11 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
where: {
|
||||
positionIsSelected: true,
|
||||
posMaster: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profile.id,
|
||||
},
|
||||
},
|
||||
|
|
@ -129,6 +139,13 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
@Example({})
|
||||
public async getGovHistory(@Path() profileId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const record = await this.profileRepo.findOne({
|
||||
where: { id: profileId },
|
||||
relations: {
|
||||
|
|
@ -138,10 +155,11 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
});
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profileId,
|
||||
},
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
@ -157,10 +175,11 @@ export class ProfileGovernmentHistoryController extends Controller {
|
|||
where: {
|
||||
positionIsSelected: true,
|
||||
posMaster: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profileId,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import { EmployeePosition } from "../entities/EmployeePosition";
|
|||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
import { calculateAge, calculateRetireDate } from "../interfaces/utils";
|
||||
import permission from "../interfaces/permission";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
@Route("api/v1/org/profile-employee/government")
|
||||
@Tags("ProfileEmployeeGovernment")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -35,7 +36,7 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
private govRepo = AppDataSource.getRepository(ProfileGovernment);
|
||||
private positionRepo = AppDataSource.getRepository(EmployeePosition);
|
||||
private posMasterRepo = AppDataSource.getRepository(EmployeePosMaster);
|
||||
|
||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||
/**
|
||||
*
|
||||
* @summary ข้อมูลราชการ
|
||||
|
|
@ -43,6 +44,13 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
*/
|
||||
@Get("user")
|
||||
public async getGovHistoryUser(@Request() request: { user: Record<string, any> }) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -56,10 +64,11 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
});
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profile.id,
|
||||
},
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
@ -136,6 +145,13 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
@Example({})
|
||||
public async getGovHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_EMP", profileEmployeeId);
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const record = await this.profileEmployeeRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
relations: {
|
||||
|
|
@ -145,10 +161,11 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
});
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profileEmployeeId,
|
||||
},
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
@ -164,10 +181,11 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
|||
where: {
|
||||
positionIsSelected: true,
|
||||
posMaster: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profileEmployeeId,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import { EmployeePosition } from "../entities/EmployeePosition";
|
|||
import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
||||
import { calculateAge, calculateRetireDate } from "../interfaces/utils";
|
||||
import permission from "../interfaces/permission";
|
||||
import { OrgRevision } from "../entities/OrgRevision";
|
||||
@Route("api/v1/org/profile-temp/government")
|
||||
@Tags("ProfileEmployeeGovernment")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -35,7 +36,7 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
private govRepo = AppDataSource.getRepository(ProfileGovernment);
|
||||
private positionRepo = AppDataSource.getRepository(EmployeePosition);
|
||||
private posMasterRepo = AppDataSource.getRepository(EmployeePosMaster);
|
||||
|
||||
private orgRevisionRepository = AppDataSource.getRepository(OrgRevision);
|
||||
/**
|
||||
*
|
||||
* @summary ข้อมูลราชการ
|
||||
|
|
@ -43,6 +44,13 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
*/
|
||||
@Get("user")
|
||||
public async getGovHistoryUser(@Request() request: { user: Record<string, any> }) {
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const profile = await this.profileEmployeeRepo.findOneBy({ keycloak: request.user.sub });
|
||||
if (!profile) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||
|
|
@ -56,10 +64,11 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
});
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profile.id,
|
||||
},
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
@ -136,6 +145,13 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
@Example({})
|
||||
public async getGovHistory(@Path() profileEmployeeId: string, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionGet(req, "SYS_REGISTRY_TEMP");
|
||||
const orgRevision = await this.orgRevisionRepository.findOne({
|
||||
select: ["id"],
|
||||
where: {
|
||||
orgRevisionIsDraft: false,
|
||||
orgRevisionIsCurrent: true,
|
||||
},
|
||||
});
|
||||
const record = await this.profileEmployeeRepo.findOne({
|
||||
where: { id: profileEmployeeId },
|
||||
relations: {
|
||||
|
|
@ -145,10 +161,11 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
});
|
||||
const posMaster = await this.posMasterRepo.findOne({
|
||||
where: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profileEmployeeId,
|
||||
},
|
||||
order: { createdAt: "DESC" },
|
||||
|
|
@ -164,10 +181,11 @@ export class ProfileGovernmentEmployeeTempController extends Controller {
|
|||
where: {
|
||||
positionIsSelected: true,
|
||||
posMaster: {
|
||||
orgRevision: {
|
||||
orgRevisionIsCurrent: true,
|
||||
orgRevisionIsDraft: false,
|
||||
},
|
||||
// orgRevision: {
|
||||
// orgRevisionIsCurrent: true,
|
||||
// orgRevisionIsDraft: false,
|
||||
// },
|
||||
orgRevisionId: orgRevision?.id,
|
||||
current_holderId: profileEmployeeId,
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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