Merge branch 'develop' into adiDev
This commit is contained in:
commit
40205a3a97
34 changed files with 442 additions and 326 deletions
|
|
@ -724,6 +724,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgRoot.orgRootFax,
|
orgTreeFax: orgRoot.orgRootFax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
responsibility: orgRoot.responsibility,
|
||||||
labelName:
|
labelName:
|
||||||
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
orgRoot.orgRootName + " " + orgRoot.orgRootCode + "00" + " " + orgRoot.orgRootShortName,
|
||||||
totalPosition: await this.posMasterRepository.count({
|
totalPosition: await this.posMasterRepository.count({
|
||||||
|
|
@ -833,6 +834,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild1.orgChild1Fax,
|
orgTreeFax: orgChild1.orgChild1Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
responsibility: orgRoot.responsibility,
|
||||||
labelName:
|
labelName:
|
||||||
orgChild1.orgChild1Name +
|
orgChild1.orgChild1Name +
|
||||||
" " +
|
" " +
|
||||||
|
|
@ -947,6 +949,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild2.orgChild2Fax,
|
orgTreeFax: orgChild2.orgChild2Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
responsibility: orgRoot.responsibility,
|
||||||
labelName:
|
labelName:
|
||||||
orgChild2.orgChild2Name +
|
orgChild2.orgChild2Name +
|
||||||
" " +
|
" " +
|
||||||
|
|
@ -1064,6 +1067,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild3.orgChild3Fax,
|
orgTreeFax: orgChild3.orgChild3Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
responsibility: orgRoot.responsibility,
|
||||||
labelName:
|
labelName:
|
||||||
orgChild3.orgChild3Name +
|
orgChild3.orgChild3Name +
|
||||||
" " +
|
" " +
|
||||||
|
|
@ -1181,6 +1185,7 @@ export class OrganizationController extends Controller {
|
||||||
orgTreeFax: orgChild4.orgChild4Fax,
|
orgTreeFax: orgChild4.orgChild4Fax,
|
||||||
orgRevisionId: orgRoot.orgRevisionId,
|
orgRevisionId: orgRoot.orgRevisionId,
|
||||||
orgRootName: orgRoot.orgRootName,
|
orgRootName: orgRoot.orgRootName,
|
||||||
|
responsibility: orgRoot.responsibility,
|
||||||
labelName:
|
labelName:
|
||||||
orgChild4.orgChild4Name +
|
orgChild4.orgChild4Name +
|
||||||
" " +
|
" " +
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
.leftJoinAndSelect("posMaster.positions", "positions")
|
.leftJoinAndSelect("posMaster.positions", "positions")
|
||||||
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
||||||
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
||||||
.leftJoinAndSelect("current_holder.profileDiscipline", "profileDiscipline")
|
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||||
.where({
|
.where({
|
||||||
|
|
@ -219,7 +219,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
result: null,
|
result: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
isPunish:
|
isPunish:
|
||||||
item.current_holder.profileDiscipline.filter(
|
item.current_holder.profileDisciplines.filter(
|
||||||
(x: any) =>
|
(x: any) =>
|
||||||
new Date(
|
new Date(
|
||||||
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
|
|
@ -278,7 +278,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
.leftJoinAndSelect("employeePosMaster.orgChild4", "orgChild4")
|
.leftJoinAndSelect("employeePosMaster.orgChild4", "orgChild4")
|
||||||
.leftJoinAndSelect("employeePosMaster.positions", "positions")
|
.leftJoinAndSelect("employeePosMaster.positions", "positions")
|
||||||
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
||||||
.leftJoinAndSelect("current_holder.profileDiscipline", "profileDiscipline")
|
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||||
.where({
|
.where({
|
||||||
|
|
@ -426,7 +426,7 @@ export class OrganizationUnauthorizeController extends Controller {
|
||||||
result: null,
|
result: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
isPunish:
|
isPunish:
|
||||||
item.current_holder.profileDiscipline.filter(
|
item.current_holder.profileDisciplines.filter(
|
||||||
(x: any) =>
|
(x: any) =>
|
||||||
new Date(
|
new Date(
|
||||||
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
|
|
|
||||||
64
src/controllers/ProfileAvatarController.ts
Normal file
64
src/controllers/ProfileAvatarController.ts
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
import { Body, Controller, Delete, Get, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||||
|
import { AppDataSource } from "../database/data-source";
|
||||||
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
|
import HttpStatus from "../interfaces/http-status";
|
||||||
|
import HttpError from "../interfaces/http-error";
|
||||||
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
|
import { Profile } from "../entities/Profile";
|
||||||
|
import { CreateProfileAvatar, ProfileAvatar } from "../entities/ProfileAvatar";
|
||||||
|
|
||||||
|
@Route("api/v1/org/profile/avatar")
|
||||||
|
@Tags("ProfileAvatar")
|
||||||
|
@Security("bearerAuth")
|
||||||
|
export class ProfileAvatarController extends Controller {
|
||||||
|
private profileRepository = AppDataSource.getRepository(Profile);
|
||||||
|
private avatarRepository = AppDataSource.getRepository(ProfileAvatar);
|
||||||
|
|
||||||
|
@Get("{profileId}")
|
||||||
|
public async getAvatar(@Path() profileId: string) {
|
||||||
|
const lists = await this.avatarRepository.find({
|
||||||
|
where: { profileId: profileId },
|
||||||
|
});
|
||||||
|
return new HttpSuccess(lists);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post()
|
||||||
|
public async newAvatar(@Request() req: RequestWithUser, @Body() body: CreateProfileAvatar) {
|
||||||
|
const profile = await this.profileRepository.findOneBy({ id: body.profileId });
|
||||||
|
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = new ProfileAvatar();
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.assign(data, { ...body, ...meta });
|
||||||
|
|
||||||
|
await this.avatarRepository.save(data);
|
||||||
|
let avatar = `ทะเบียนประวัติ/โปรไฟล์/${profile.id}/profile-${data.id}`;
|
||||||
|
data.avatar = avatar;
|
||||||
|
await this.avatarRepository.save(data);
|
||||||
|
profile.avatar = avatar;
|
||||||
|
await this.profileRepository.save(profile);
|
||||||
|
|
||||||
|
return new HttpSuccess(avatar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete("{avatarId}")
|
||||||
|
public async deleteAvatar(@Path() avatarId: string) {
|
||||||
|
const result = await this.avatarRepository.delete({ id: avatarId });
|
||||||
|
|
||||||
|
if (result.affected == undefined || result.affected <= 0) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
67
src/controllers/ProfileAvatarEmployeeController.ts
Normal file
67
src/controllers/ProfileAvatarEmployeeController.ts
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
import { Body, Controller, Delete, Get, Path, Post, Request, Route, Security, Tags } from "tsoa";
|
||||||
|
import { AppDataSource } from "../database/data-source";
|
||||||
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
|
import HttpStatus from "../interfaces/http-status";
|
||||||
|
import HttpError from "../interfaces/http-error";
|
||||||
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
|
import { CreateProfileEmployeeAvatar, ProfileAvatar } from "../entities/ProfileAvatar";
|
||||||
|
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||||
|
|
||||||
|
@Route("api/v1/org/profile-employee/avatar")
|
||||||
|
@Tags("ProfileAvatar")
|
||||||
|
@Security("bearerAuth")
|
||||||
|
export class ProfileAvatarEmployeeController extends Controller {
|
||||||
|
private profileRepository = AppDataSource.getRepository(ProfileEmployee);
|
||||||
|
private avatarRepository = AppDataSource.getRepository(ProfileAvatar);
|
||||||
|
|
||||||
|
@Get("{profileId}")
|
||||||
|
public async getAvatar(@Path() profileId: string) {
|
||||||
|
const lists = await this.avatarRepository.find({
|
||||||
|
where: { profileEmployeeId: profileId },
|
||||||
|
});
|
||||||
|
return new HttpSuccess(lists);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Post()
|
||||||
|
public async newAvatar(
|
||||||
|
@Request() req: RequestWithUser,
|
||||||
|
@Body() body: CreateProfileEmployeeAvatar,
|
||||||
|
) {
|
||||||
|
const profile = await this.profileRepository.findOneBy({ id: body.profileEmployeeId });
|
||||||
|
|
||||||
|
if (!profile) {
|
||||||
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = new ProfileAvatar();
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
createdUserId: req.user.sub,
|
||||||
|
createdFullName: req.user.name,
|
||||||
|
lastUpdateUserId: req.user.sub,
|
||||||
|
lastUpdateFullName: req.user.name,
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.assign(data, { ...body, ...meta });
|
||||||
|
|
||||||
|
await this.avatarRepository.save(data);
|
||||||
|
let avatar = `ทะเบียนประวัติ/โปรไฟล์/${profile.id}/profile-employee-${data.id}`;
|
||||||
|
data.avatar = avatar;
|
||||||
|
await this.avatarRepository.save(data);
|
||||||
|
profile.avatar = avatar;
|
||||||
|
await this.profileRepository.save(profile);
|
||||||
|
|
||||||
|
return new HttpSuccess(avatar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete("{avatarId}")
|
||||||
|
public async deleteAvatar(@Path() avatarId: string) {
|
||||||
|
const result = await this.avatarRepository.delete({ id: avatarId });
|
||||||
|
|
||||||
|
if (result.affected == undefined || result.affected <= 0) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HttpSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -222,7 +222,7 @@ export class ProfileController extends Controller {
|
||||||
@Request() request: RequestWithUser,
|
@Request() request: RequestWithUser,
|
||||||
@Body() body: CreateProfileAllFields,
|
@Body() body: CreateProfileAllFields,
|
||||||
) {
|
) {
|
||||||
const profileExist = await this.profileRepo.findOneBy({ citizenId: body.citizenId })
|
const profileExist = await this.profileRepo.findOneBy({ citizenId: body.citizenId });
|
||||||
if (profileExist) {
|
if (profileExist) {
|
||||||
return new HttpSuccess(profileExist.id);
|
return new HttpSuccess(profileExist.id);
|
||||||
}
|
}
|
||||||
|
|
@ -759,11 +759,11 @@ export class ProfileController extends Controller {
|
||||||
? null
|
? null
|
||||||
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
|
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
|
||||||
|
|
||||||
const position = await this.positionRepository.findOne({
|
const position = await this.positionRepository.findOne({
|
||||||
relations: ["posExecutive"],
|
relations: ["posExecutive"],
|
||||||
where: {
|
where: {
|
||||||
posMasterId: posMaster?.id
|
posMasterId: posMaster?.id,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const _profile: any = {
|
const _profile: any = {
|
||||||
|
|
@ -781,15 +781,16 @@ export class ProfileController extends Controller {
|
||||||
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
||||||
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
||||||
posTypeId: profile.posType == null ? null : profile.posType.id,
|
posTypeId: profile.posType == null ? null : profile.posType.id,
|
||||||
posExecutiveName: position == null || position.posExecutive == null
|
posExecutiveName:
|
||||||
? null
|
position == null || position.posExecutive == null
|
||||||
: position.posExecutive.posExecutiveName,
|
? null
|
||||||
posExecutivePriority: position == null || position.posExecutive == null
|
: position.posExecutive.posExecutiveName,
|
||||||
? null
|
posExecutivePriority:
|
||||||
: position.posExecutive.posExecutivePriority,
|
position == null || position.posExecutive == null
|
||||||
posExecutiveId: position == null || position.posExecutive == null
|
? null
|
||||||
? null
|
: position.posExecutive.posExecutivePriority,
|
||||||
: position.posExecutive.id,
|
posExecutiveId:
|
||||||
|
position == null || position.posExecutive == null ? null : position.posExecutive.id,
|
||||||
rootId:
|
rootId:
|
||||||
profile.current_holders == null ||
|
profile.current_holders == null ||
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot ==
|
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot ==
|
||||||
|
|
@ -1729,7 +1730,7 @@ export class ProfileController extends Controller {
|
||||||
.leftJoinAndSelect("posMaster.positions", "positions")
|
.leftJoinAndSelect("posMaster.positions", "positions")
|
||||||
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
|
||||||
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
||||||
.leftJoinAndSelect("current_holder.profileDiscipline", "profileDiscipline")
|
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||||
.where((qb) => {
|
.where((qb) => {
|
||||||
|
|
@ -1890,7 +1891,7 @@ export class ProfileController extends Controller {
|
||||||
result: null,
|
result: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
isPunish:
|
isPunish:
|
||||||
item.current_holder.profileDiscipline.filter(
|
item.current_holder.profileDisciplines.filter(
|
||||||
(x: any) =>
|
(x: any) =>
|
||||||
new Date(
|
new Date(
|
||||||
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
|
|
@ -1937,14 +1938,14 @@ export class ProfileController extends Controller {
|
||||||
const posMaster = await this.posMasterRepo.findOne({
|
const posMaster = await this.posMasterRepo.findOne({
|
||||||
where: {
|
where: {
|
||||||
current_holderId: profile.id,
|
current_holderId: profile.id,
|
||||||
orgRevisionId: revisionId
|
orgRevisionId: revisionId,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
const position = await this.positionRepository.findOne({
|
const position = await this.positionRepository.findOne({
|
||||||
relations: ["posExecutive"],
|
relations: ["posExecutive"],
|
||||||
where: {
|
where: {
|
||||||
posMasterId: posMaster?.id
|
posMasterId: posMaster?.id,
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const _profile = {
|
const _profile = {
|
||||||
|
|
@ -1961,15 +1962,16 @@ export class ProfileController extends Controller {
|
||||||
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
|
||||||
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
|
||||||
posTypeId: profile.posType == null ? null : profile.posType.id,
|
posTypeId: profile.posType == null ? null : profile.posType.id,
|
||||||
posExecutiveName: position == null || position.posExecutive == null
|
posExecutiveName:
|
||||||
? null
|
position == null || position.posExecutive == null
|
||||||
: position.posExecutive.posExecutiveName,
|
? null
|
||||||
posExecutivePriority: position == null || position.posExecutive == null
|
: position.posExecutive.posExecutiveName,
|
||||||
? null
|
posExecutivePriority:
|
||||||
: position.posExecutive.posExecutivePriority,
|
position == null || position.posExecutive == null
|
||||||
posExecutiveId: position == null || position.posExecutive == null
|
? null
|
||||||
? null
|
: position.posExecutive.posExecutivePriority,
|
||||||
: position.posExecutive.id,
|
posExecutiveId:
|
||||||
|
position == null || position.posExecutive == null ? null : position.posExecutive.id,
|
||||||
rootId:
|
rootId:
|
||||||
profile.current_holders == null ||
|
profile.current_holders == null ||
|
||||||
profile.current_holders.find((x) => x.orgRevisionId == revisionId) == null ||
|
profile.current_holders.find((x) => x.orgRevisionId == revisionId) == null ||
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ export class ProfileDisciplineController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{disciplineId}")
|
@Delete("{disciplineId}")
|
||||||
public async deleteTraning(@Path() disciplineId: string) {
|
public async deleteDiscipline(@Path() disciplineId: string) {
|
||||||
await this.disciplineHistoryRepository.delete({
|
await this.disciplineHistoryRepository.delete({
|
||||||
profileDisciplineId: disciplineId,
|
profileDisciplineId: disciplineId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -145,7 +145,7 @@ export class ProfileDisciplineEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{disciplineId}")
|
@Delete("{disciplineId}")
|
||||||
public async deleteTraning(@Path() disciplineId: string) {
|
public async deleteDiscipline(@Path() disciplineId: string) {
|
||||||
await this.disciplineHistoryRepository.delete({
|
await this.disciplineHistoryRepository.delete({
|
||||||
profileDisciplineId: disciplineId,
|
profileDisciplineId: disciplineId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ export class ProfileDutyController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{dutyId}")
|
@Delete("{dutyId}")
|
||||||
public async deleteTraning(@Path() dutyId: string) {
|
public async deleteDuty(@Path() dutyId: string) {
|
||||||
await this.dutyHistoryRepository.delete({
|
await this.dutyHistoryRepository.delete({
|
||||||
profileDutyId: dutyId,
|
profileDutyId: dutyId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ export class ProfileDutyEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{dutyId}")
|
@Delete("{dutyId}")
|
||||||
public async deleteTraning(@Path() dutyId: string) {
|
public async deleteDuty(@Path() dutyId: string) {
|
||||||
await this.dutyHistoryRepository.delete({
|
await this.dutyHistoryRepository.delete({
|
||||||
profileDutyId: dutyId,
|
profileDutyId: dutyId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -975,7 +975,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
.leftJoinAndSelect("employeePosMaster.orgChild4", "orgChild4")
|
.leftJoinAndSelect("employeePosMaster.orgChild4", "orgChild4")
|
||||||
.leftJoinAndSelect("employeePosMaster.positions", "positions")
|
.leftJoinAndSelect("employeePosMaster.positions", "positions")
|
||||||
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
|
||||||
.leftJoinAndSelect("current_holder.profileDiscipline", "profileDiscipline")
|
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
|
||||||
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
|
||||||
.leftJoinAndSelect("current_holder.posType", "posType")
|
.leftJoinAndSelect("current_holder.posType", "posType")
|
||||||
.where((qb) => {
|
.where((qb) => {
|
||||||
|
|
@ -1128,7 +1128,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
result: null,
|
result: null,
|
||||||
duration: null,
|
duration: null,
|
||||||
isPunish:
|
isPunish:
|
||||||
item.current_holder.profileDiscipline.filter(
|
item.current_holder.profileDisciplines.filter(
|
||||||
(x: any) =>
|
(x: any) =>
|
||||||
new Date(
|
new Date(
|
||||||
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
`${new Date(x.date).getFullYear()}-${String(new Date(x.date).getMonth() + 1).padStart(2, "0")}-${String(new Date(x.date).getDate() + 1).padStart(2, "0")}T00:00:00.000Z`,
|
||||||
|
|
|
||||||
|
|
@ -114,34 +114,34 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
return new HttpSuccess(record);
|
return new HttpSuccess(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
*
|
// *
|
||||||
* @summary เพิ่มข้อมูลราชการ
|
// * @summary เพิ่มข้อมูลราชการ
|
||||||
*
|
// *
|
||||||
*/
|
// */
|
||||||
@Post()
|
// @Post()
|
||||||
public async newGov(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeGovernment) {
|
// public async newGov(@Request() req: RequestWithUser, @Body() body: CreateProfileEmployeeGovernment) {
|
||||||
if (!body.profileEmployeeId) {
|
// if (!body.profileEmployeeId) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
// throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileEmployeeId");
|
||||||
}
|
// }
|
||||||
|
|
||||||
const profile = await this.profileEmployeeRepo.findOneBy({ id: body.profileEmployeeId });
|
// const profile = await this.profileEmployeeRepo.findOneBy({ id: body.profileEmployeeId });
|
||||||
if (!profile) {
|
// if (!profile) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
// throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
// }
|
||||||
|
|
||||||
const data = new ProfileGovernment();
|
// const data = new ProfileGovernment();
|
||||||
const meta = {
|
// const meta = {
|
||||||
createdUserId: req.user.sub,
|
// createdUserId: req.user.sub,
|
||||||
createdFullName: req.user.name,
|
// createdFullName: req.user.name,
|
||||||
lastUpdateUserId: req.user.sub,
|
// lastUpdateUserId: req.user.sub,
|
||||||
lastUpdateFullName: req.user.name,
|
// lastUpdateFullName: req.user.name,
|
||||||
};
|
// };
|
||||||
|
|
||||||
Object.assign(data, { ...body, ...meta });
|
// Object.assign(data, { ...body, ...meta });
|
||||||
await this.govRepo.save(data);
|
// await this.govRepo.save(data);
|
||||||
return new HttpSuccess();
|
// return new HttpSuccess();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -172,17 +172,17 @@ export class ProfileGovernmentEmployeeController extends Controller {
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
*
|
// *
|
||||||
* @summary ลบข้อมูลราชการ
|
// * @summary ลบข้อมูลราชการ
|
||||||
*
|
// *
|
||||||
*/
|
// */
|
||||||
@Delete("{profileEmployeeId}")
|
// @Delete("{profileEmployeeId}")
|
||||||
public async deleteGov(@Path() profileEmployeeId: string) {
|
// public async deleteGov(@Path() profileEmployeeId: string) {
|
||||||
const result = await this.govRepo.delete({ profileEmployeeId: profileEmployeeId });
|
// const result = await this.govRepo.delete({ profileEmployeeId: profileEmployeeId });
|
||||||
if (result.affected == undefined || result.affected <= 0) {
|
// if (result.affected == undefined || result.affected <= 0) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
// throw new HttpError(HttpStatus.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
// }
|
||||||
return new HttpSuccess();
|
// return new HttpSuccess();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
@ -221,7 +221,7 @@ export class ProfileLeaveController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{leaveId}")
|
@Delete("{leaveId}")
|
||||||
public async deleteTraning(@Path() leaveId: string) {
|
public async deleteLeave(@Path() leaveId: string) {
|
||||||
await this.leaveHistoryRepo.delete({
|
await this.leaveHistoryRepo.delete({
|
||||||
profileLeaveId: leaveId,
|
profileLeaveId: leaveId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export class ProfileLeaveEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{leaveId}")
|
@Delete("{leaveId}")
|
||||||
public async deleteTraning(@Path() leaveId: string) {
|
public async deleteLeave(@Path() leaveId: string) {
|
||||||
await this.leaveHistoryRepo.delete({
|
await this.leaveHistoryRepo.delete({
|
||||||
profileLeaveId: leaveId,
|
profileLeaveId: leaveId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ export class ProfileNopaidController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{nopaidId}")
|
@Delete("{nopaidId}")
|
||||||
public async deleteTraning(@Path() nopaidId: string) {
|
public async deleteNopaid(@Path() nopaidId: string) {
|
||||||
await this.nopaidHistoryRepository.delete({
|
await this.nopaidHistoryRepository.delete({
|
||||||
profileNopaidId: nopaidId,
|
profileNopaidId: nopaidId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ export class ProfileNopaidEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{nopaidId}")
|
@Delete("{nopaidId}")
|
||||||
public async deleteTraning(@Path() nopaidId: string) {
|
public async deleteNopaid(@Path() nopaidId: string) {
|
||||||
await this.nopaidHistoryRepository.delete({
|
await this.nopaidHistoryRepository.delete({
|
||||||
profileNopaidId: nopaidId,
|
profileNopaidId: nopaidId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,7 @@ export class ProfileOtherController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{otherId}")
|
@Delete("{otherId}")
|
||||||
public async deleteTraning(@Path() otherId: string) {
|
public async deleteOther(@Path() otherId: string) {
|
||||||
await this.otherHistoryRepository.delete({
|
await this.otherHistoryRepository.delete({
|
||||||
profileOtherId: otherId,
|
profileOtherId: otherId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ export class ProfileOtherEmployeeController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Delete("{otherId}")
|
@Delete("{otherId}")
|
||||||
public async deleteTraning(@Path() otherId: string) {
|
public async deleteOther(@Path() otherId: string) {
|
||||||
await this.otherHistoryRepository.delete({
|
await this.otherHistoryRepository.delete({
|
||||||
profileOtherId: otherId,
|
profileOtherId: otherId,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,14 @@ import {
|
||||||
import { AppDataSource } from "../database/data-source";
|
import { AppDataSource } from "../database/data-source";
|
||||||
import {
|
import {
|
||||||
CreateProfileSalaryEmployee,
|
CreateProfileSalaryEmployee,
|
||||||
ProfileSalary,
|
ProfileSalaryEmployee,
|
||||||
UpdateProfileSalary,
|
UpdateProfileSalaryEmployee,
|
||||||
} from "../entities/ProfileSalary";
|
} from "../entities/ProfileSalaryEmployee";
|
||||||
import HttpSuccess from "../interfaces/http-success";
|
import HttpSuccess from "../interfaces/http-success";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
||||||
import { RequestWithUser } from "../middlewares/user";
|
import { RequestWithUser } from "../middlewares/user";
|
||||||
import { Profile } from "../entities/Profile";
|
|
||||||
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
import { ProfileEmployee } from "../entities/ProfileEmployee";
|
||||||
import { LessThan, MoreThan } from "typeorm";
|
import { LessThan, MoreThan } from "typeorm";
|
||||||
|
|
||||||
|
|
@ -32,13 +31,13 @@ import { LessThan, MoreThan } from "typeorm";
|
||||||
@Security("bearerAuth")
|
@Security("bearerAuth")
|
||||||
export class ProfileSalaryEmployeeController extends Controller {
|
export class ProfileSalaryEmployeeController extends Controller {
|
||||||
private profileRepo = AppDataSource.getRepository(ProfileEmployee);
|
private profileRepo = AppDataSource.getRepository(ProfileEmployee);
|
||||||
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
|
private salaryRepo = AppDataSource.getRepository(ProfileSalaryEmployee);
|
||||||
private salaryHistoryRepo = AppDataSource.getRepository(ProfileSalaryHistory);
|
private salaryHistoryRepo = AppDataSource.getRepository(ProfileSalaryHistory);
|
||||||
|
|
||||||
@Get("{profileId}")
|
@Get("{profileId}")
|
||||||
public async getSalary(@Path() profileId: string) {
|
public async getSalary(@Path() profileId: string) {
|
||||||
const record = await this.salaryRepo.find({
|
const record = await this.salaryRepo.find({
|
||||||
where: { profileEmployeeId: profileId },
|
where: { profileId: profileId },
|
||||||
order: { order: "ASC" },
|
order: { order: "ASC" },
|
||||||
});
|
});
|
||||||
return new HttpSuccess(record);
|
return new HttpSuccess(record);
|
||||||
|
|
@ -57,22 +56,22 @@ export class ProfileSalaryEmployeeController extends Controller {
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Body() body: CreateProfileSalaryEmployee,
|
@Body() body: CreateProfileSalaryEmployee,
|
||||||
) {
|
) {
|
||||||
if (!body.profileEmployeeId) {
|
if (!body.profileId) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "กรุณากรอก profileId");
|
||||||
}
|
}
|
||||||
|
|
||||||
const profile = await this.profileRepo.findOneBy({ id: body.profileEmployeeId });
|
const profile = await this.profileRepo.findOneBy({ id: body.profileId });
|
||||||
|
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
|
||||||
}
|
}
|
||||||
|
|
||||||
const dest_item = await this.salaryRepo.findOne({
|
const dest_item = await this.salaryRepo.findOne({
|
||||||
where: { profileId: body.profileEmployeeId },
|
where: { profileId: body.profileId },
|
||||||
order: { order: "DESC" },
|
order: { order: "DESC" },
|
||||||
});
|
});
|
||||||
|
|
||||||
const data = new ProfileSalary();
|
const data = new ProfileSalaryEmployee();
|
||||||
|
|
||||||
const meta = {
|
const meta = {
|
||||||
order: dest_item == null ? 1 : dest_item.order + 1,
|
order: dest_item == null ? 1 : dest_item.order + 1,
|
||||||
|
|
@ -92,7 +91,7 @@ export class ProfileSalaryEmployeeController extends Controller {
|
||||||
@Patch("{salaryId}")
|
@Patch("{salaryId}")
|
||||||
public async editSalary(
|
public async editSalary(
|
||||||
@Request() req: RequestWithUser,
|
@Request() req: RequestWithUser,
|
||||||
@Body() body: UpdateProfileSalary,
|
@Body() body: UpdateProfileSalaryEmployee,
|
||||||
@Path() salaryId: string,
|
@Path() salaryId: string,
|
||||||
) {
|
) {
|
||||||
const record = await this.salaryRepo.findOneBy({ id: salaryId });
|
const record = await this.salaryRepo.findOneBy({ id: salaryId });
|
||||||
|
|
|
||||||
|
|
@ -108,14 +108,13 @@ export class OrgChild1 extends EntityBase {
|
||||||
})
|
})
|
||||||
ancestorDNA: string;
|
ancestorDNA: string;
|
||||||
|
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
length: 255,
|
length: 255,
|
||||||
comment: "หน้าที่ความรับผิดชอบ",
|
comment: "หน้าที่ความรับผิดชอบ",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
duty: string;
|
responsibility: string;
|
||||||
|
|
||||||
@ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgChild1s)
|
@ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgChild1s)
|
||||||
@JoinColumn({ name: "orgRevisionId" })
|
@JoinColumn({ name: "orgRevisionId" })
|
||||||
|
|
@ -165,10 +164,9 @@ export class CreateOrgChild1 {
|
||||||
|
|
||||||
@Column("uuid")
|
@Column("uuid")
|
||||||
orgRootId: string;
|
orgRootId: string;
|
||||||
|
|
||||||
@Column()
|
|
||||||
duty?: string;
|
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
responsibility?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateOrgChild1 = Partial<CreateOrgChild1> & { orgChild1Rank?: OrgChild1Rank };
|
export type UpdateOrgChild1 = Partial<CreateOrgChild1> & { orgChild1Rank?: OrgChild1Rank };
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ export class OrgChild2 extends EntityBase {
|
||||||
comment: "หน้าที่ความรับผิดชอบ",
|
comment: "หน้าที่ความรับผิดชอบ",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
duty: string;
|
responsibility: string;
|
||||||
|
|
||||||
@ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgChild2s)
|
@ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgChild2s)
|
||||||
@JoinColumn({ name: "orgRevisionId" })
|
@JoinColumn({ name: "orgRevisionId" })
|
||||||
|
|
@ -172,7 +172,6 @@ export class CreateOrgChild2 {
|
||||||
orgChild1Id: string;
|
orgChild1Id: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
duty?: string;
|
responsibility?: string;
|
||||||
|
|
||||||
}
|
}
|
||||||
export type UpdateOrgChild2 = Partial<CreateOrgChild2> & { orgChild2Rank?: OrgChild2Rank };
|
export type UpdateOrgChild2 = Partial<CreateOrgChild2> & { orgChild2Rank?: OrgChild2Rank };
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@ export class OrgChild3 extends EntityBase {
|
||||||
comment: "หน้าที่ความรับผิดชอบ",
|
comment: "หน้าที่ความรับผิดชอบ",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
duty: string;
|
responsibility: string;
|
||||||
|
|
||||||
@ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgChild3s)
|
@ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgChild3s)
|
||||||
@JoinColumn({ name: "orgRevisionId" })
|
@JoinColumn({ name: "orgRevisionId" })
|
||||||
|
|
@ -180,7 +180,7 @@ export class CreateOrgChild3 {
|
||||||
orgChild2Id: string;
|
orgChild2Id: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
duty?: string;
|
responsibility?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UpdateOrgChild3 = Partial<CreateOrgChild3> & { orgChild3Rank?: OrgChild3Rank };
|
export type UpdateOrgChild3 = Partial<CreateOrgChild3> & { orgChild3Rank?: OrgChild3Rank };
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ export class OrgChild4 extends EntityBase {
|
||||||
comment: "หน้าที่ความรับผิดชอบ",
|
comment: "หน้าที่ความรับผิดชอบ",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
duty: string;
|
responsibility: string;
|
||||||
|
|
||||||
@ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgChild4s)
|
@ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgChild4s)
|
||||||
@JoinColumn({ name: "orgRevisionId" })
|
@JoinColumn({ name: "orgRevisionId" })
|
||||||
|
|
@ -186,6 +186,6 @@ export class CreateOrgChild4 {
|
||||||
orgChild3Id: string;
|
orgChild3Id: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
duty?: string;
|
responsibility?: string;
|
||||||
}
|
}
|
||||||
export type UpdateOrgChild4 = Partial<OrgChild4>;
|
export type UpdateOrgChild4 = Partial<OrgChild4>;
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ export class OrgRoot extends EntityBase {
|
||||||
comment: "หน้าที่ความรับผิดชอบ",
|
comment: "หน้าที่ความรับผิดชอบ",
|
||||||
default: null,
|
default: null,
|
||||||
})
|
})
|
||||||
duty: string;
|
responsibility: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
length: 40,
|
length: 40,
|
||||||
|
|
@ -156,7 +156,7 @@ export class CreateOrgRoot {
|
||||||
orgRootFax?: string;
|
orgRootFax?: string;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
duty?: string;
|
responsibility?: string;
|
||||||
|
|
||||||
@Column("uuid")
|
@Column("uuid")
|
||||||
orgRevisionId: string;
|
orgRevisionId: string;
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { PosMaster } from "./PosMaster";
|
||||||
import { PosLevel } from "./PosLevel";
|
import { PosLevel } from "./PosLevel";
|
||||||
import { PosType } from "./PosType";
|
import { PosType } from "./PosType";
|
||||||
import { ProfileSalary } from "./ProfileSalary";
|
import { ProfileSalary } from "./ProfileSalary";
|
||||||
import { ProfileDiscipline } from "./ProfileDiscipline";
|
|
||||||
import { ProfileCertificate } from "./ProfileCertificate";
|
import { ProfileCertificate } from "./ProfileCertificate";
|
||||||
import { ProfileEducation } from "./ProfileEducation";
|
import { ProfileEducation } from "./ProfileEducation";
|
||||||
import { ProfileTraining } from "./ProfileTraining";
|
import { ProfileTraining } from "./ProfileTraining";
|
||||||
|
|
@ -21,9 +20,18 @@ import { ProfileGovernment } from "./ProfileGovernment";
|
||||||
import { Province } from "./Province";
|
import { Province } from "./Province";
|
||||||
import { SubDistrict } from "./SubDistrict";
|
import { SubDistrict } from "./SubDistrict";
|
||||||
import { District } from "./District";
|
import { District } from "./District";
|
||||||
|
import { ProfileAvatar } from "./ProfileAvatar";
|
||||||
|
import { ProfileDiscipline } from "./ProfileDiscipline";
|
||||||
|
|
||||||
@Entity("profile")
|
@Entity("profile")
|
||||||
export class Profile extends EntityBase {
|
export class Profile extends EntityBase {
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "รูปถ่าย",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
avatar: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ยศ",
|
comment: "ยศ",
|
||||||
|
|
@ -259,7 +267,7 @@ export class Profile extends EntityBase {
|
||||||
profileSalary: ProfileSalary[];
|
profileSalary: ProfileSalary[];
|
||||||
|
|
||||||
@OneToMany(() => ProfileDiscipline, (profileDiscipline) => profileDiscipline.profile)
|
@OneToMany(() => ProfileDiscipline, (profileDiscipline) => profileDiscipline.profile)
|
||||||
profileDiscipline: ProfileDiscipline[];
|
profileDisciplines: ProfileDiscipline[];
|
||||||
|
|
||||||
@OneToMany(() => ProfileCertificate, (profileCertificate) => profileCertificate.profile)
|
@OneToMany(() => ProfileCertificate, (profileCertificate) => profileCertificate.profile)
|
||||||
profileCertificates: ProfileCertificate[];
|
profileCertificates: ProfileCertificate[];
|
||||||
|
|
@ -294,6 +302,9 @@ export class Profile extends EntityBase {
|
||||||
@OneToMany(() => ProfileOther, (profileOther) => profileOther.profile)
|
@OneToMany(() => ProfileOther, (profileOther) => profileOther.profile)
|
||||||
profileOthers: ProfileOther[];
|
profileOthers: ProfileOther[];
|
||||||
|
|
||||||
|
@OneToMany(() => ProfileAvatar, (profileAvatar) => profileAvatar.profile)
|
||||||
|
profileAvatars: ProfileAvatar[];
|
||||||
|
|
||||||
@OneToMany(() => ProfileFamilyHistory, (profileFamily) => profileFamily.profile)
|
@OneToMany(() => ProfileFamilyHistory, (profileFamily) => profileFamily.profile)
|
||||||
profileFamily: ProfileFamilyHistory[];
|
profileFamily: ProfileFamilyHistory[];
|
||||||
|
|
||||||
|
|
@ -576,35 +587,35 @@ export class CreateProfileAllFields {
|
||||||
posLevelId: string | null;
|
posLevelId: string | null;
|
||||||
posTypeId: string | null;
|
posTypeId: string | null;
|
||||||
email: string | null;
|
email: string | null;
|
||||||
phone: string | null;
|
phone: string | null;
|
||||||
keycloak: string | null;
|
keycloak: string | null;
|
||||||
isProbation: boolean | null;
|
isProbation: boolean | null;
|
||||||
isLeave : boolean | null;
|
isLeave: boolean | null;
|
||||||
dateRetire : Date | null;
|
dateRetire: Date | null;
|
||||||
dateAppoint : Date | null;
|
dateAppoint: Date | null;
|
||||||
dateStart: Date | null;
|
dateStart: Date | null;
|
||||||
govAgeAbsent: number | null;
|
govAgeAbsent: number | null;
|
||||||
govAgePlus: number | null;
|
govAgePlus: number | null;
|
||||||
birthDate: Date | null;
|
birthDate: Date | null;
|
||||||
reasonSameDate : Date | null;
|
reasonSameDate: Date | null;
|
||||||
ethnicity : string | null;
|
ethnicity: string | null;
|
||||||
telephoneNumber : string | null;
|
telephoneNumber: string | null;
|
||||||
nationality : string | null;
|
nationality: string | null;
|
||||||
gender : string | null;
|
gender: string | null;
|
||||||
relationship : string | null;
|
relationship: string | null;
|
||||||
religion : string | null;
|
religion: string | null;
|
||||||
bloodGroup : string | null;
|
bloodGroup: string | null;
|
||||||
registrationAddress : string | null;
|
registrationAddress: string | null;
|
||||||
registrationProvinceId : string | null;
|
registrationProvinceId: string | null;
|
||||||
registrationDistrictId: string | null;
|
registrationDistrictId: string | null;
|
||||||
registrationSubDistrictId : string | null;
|
registrationSubDistrictId: string | null;
|
||||||
registrationZipCode : string | null;
|
registrationZipCode: string | null;
|
||||||
currentAddress : string | null;
|
currentAddress: string | null;
|
||||||
currentProvinceId : string | null;
|
currentProvinceId: string | null;
|
||||||
currentDistrictId : string | null;
|
currentDistrictId: string | null;
|
||||||
currentSubDistrictId : string | null;
|
currentSubDistrictId: string | null;
|
||||||
currentZipCode : string | null;
|
currentZipCode: string | null;
|
||||||
};
|
}
|
||||||
|
|
||||||
export type UpdateProfile = {
|
export type UpdateProfile = {
|
||||||
rank?: string | null;
|
rank?: string | null;
|
||||||
|
|
|
||||||
52
src/entities/ProfileAvatar.ts
Normal file
52
src/entities/ProfileAvatar.ts
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||||
|
import { EntityBase } from "./base/Base";
|
||||||
|
import { Profile } from "./Profile";
|
||||||
|
import { ProfileEmployee } from "./ProfileEmployee";
|
||||||
|
|
||||||
|
@Entity("profileAvatar")
|
||||||
|
export class ProfileAvatar extends EntityBase {
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "รูปถ่าย",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
avatar: 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;
|
||||||
|
|
||||||
|
@ManyToOne(() => Profile, (profile) => profile.profileAvatars)
|
||||||
|
@JoinColumn({ name: "profileId" })
|
||||||
|
profile: Profile;
|
||||||
|
|
||||||
|
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileAvatars)
|
||||||
|
@JoinColumn({ name: "profileEmployeeId" })
|
||||||
|
profileEmployee: ProfileEmployee;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateProfileAvatar {
|
||||||
|
profileId: string;
|
||||||
|
// avatar: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class CreateProfileEmployeeAvatar {
|
||||||
|
profileEmployeeId: string;
|
||||||
|
// avatar: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type UpdateProfileAvatar = {
|
||||||
|
avatar?: string | null;
|
||||||
|
};
|
||||||
|
|
@ -75,7 +75,7 @@ export class ProfileDiscipline extends EntityBase {
|
||||||
)
|
)
|
||||||
profileDisciplineHistories: ProfileDisciplineHistory[];
|
profileDisciplineHistories: ProfileDisciplineHistory[];
|
||||||
|
|
||||||
@ManyToOne(() => Profile, (profile) => profile.profileDiscipline)
|
@ManyToOne(() => Profile, (profile) => profile.profileDisciplines)
|
||||||
@JoinColumn({ name: "profileId" })
|
@JoinColumn({ name: "profileId" })
|
||||||
profile: Profile;
|
profile: Profile;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,106 +0,0 @@
|
||||||
import { Entity, Column, ManyToOne, JoinColumn, OneToMany } from "typeorm";
|
|
||||||
import { EntityBase } from "./base/Base";
|
|
||||||
import { ProfileEmployee } from "./ProfileEmployee";
|
|
||||||
import { ProfileDisciplineEmployeeHistory } from "./ProfileDisciplineEmployeeHistory";
|
|
||||||
|
|
||||||
@Entity("profileDisciplineEmployee")
|
|
||||||
export class ProfileDisciplineEmployee extends EntityBase {
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
type: "datetime",
|
|
||||||
comment: "วันที่",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
date: Date;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
length: 40,
|
|
||||||
comment: "ไอดีโปรไฟล์",
|
|
||||||
type: "uuid",
|
|
||||||
})
|
|
||||||
profileId: string;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
comment: "สถานะการใช้งาน",
|
|
||||||
default: false,
|
|
||||||
})
|
|
||||||
isActive: boolean;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
comment: "ระดับความผิด",
|
|
||||||
type: "text",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
level: string;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
comment: "รายละเอียด",
|
|
||||||
type: "text",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
detail: string;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
type: "datetime",
|
|
||||||
comment: "เอกสารอ้างอิง (ลงวันที่)",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
refCommandDate: Date;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
|
|
||||||
type: "text",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
refCommandNo: string;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
comment: "ล้างมลทิน",
|
|
||||||
type: "text",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
unStigma: string;
|
|
||||||
|
|
||||||
@OneToMany(
|
|
||||||
() => ProfileDisciplineEmployeeHistory,
|
|
||||||
(profileDisciplineHistory) => profileDisciplineHistory.histories,
|
|
||||||
)
|
|
||||||
profileDisciplineHistories: ProfileDisciplineEmployeeHistory[];
|
|
||||||
|
|
||||||
@ManyToOne(() => ProfileEmployee, (profile) => profile.profileDiscipline)
|
|
||||||
@JoinColumn({ name: "profileId" })
|
|
||||||
profile: ProfileEmployee;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CreateProfileDisciplineEmployee {
|
|
||||||
@Column()
|
|
||||||
date: Date | null;
|
|
||||||
|
|
||||||
@Column()
|
|
||||||
profileId: string;
|
|
||||||
|
|
||||||
@Column()
|
|
||||||
isActive: boolean | null;
|
|
||||||
|
|
||||||
@Column()
|
|
||||||
level: string | null;
|
|
||||||
|
|
||||||
@Column()
|
|
||||||
detail: string | null;
|
|
||||||
|
|
||||||
@Column()
|
|
||||||
refCommandDate: Date | null;
|
|
||||||
|
|
||||||
@Column()
|
|
||||||
refCommandNo: string | null;
|
|
||||||
|
|
||||||
@Column()
|
|
||||||
unStigma: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type UpdateProfileDisciplineEmployee = Partial<CreateProfileDisciplineEmployee>;
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
|
|
||||||
import { EntityBase } from "./base/Base";
|
|
||||||
import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee";
|
|
||||||
|
|
||||||
@Entity("profileDisciplineEmployeeHistory")
|
|
||||||
export class ProfileDisciplineEmployeeHistory extends EntityBase {
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
type: "datetime",
|
|
||||||
comment: "วันที่",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
date: Date;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
length: 40,
|
|
||||||
comment: "ล้างมลทิน",
|
|
||||||
type: "uuid",
|
|
||||||
})
|
|
||||||
profileDisciplineId: string;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
comment: "สถานะการใช้งาน",
|
|
||||||
default: false,
|
|
||||||
})
|
|
||||||
isActive: boolean;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
comment: "ระดับความผิด",
|
|
||||||
type: "text",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
level: string;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
comment: "รายละเอียด",
|
|
||||||
type: "text",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
detail: string;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
type: "datetime",
|
|
||||||
comment: "เอกสารอ้างอิง (ลงวันที่)",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
refCommandDate: Date;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
comment: "เอกสารอ้างอิง (เลขที่คำสั่ง)",
|
|
||||||
type: "text",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
refCommandNo: string;
|
|
||||||
|
|
||||||
@Column({
|
|
||||||
nullable: true,
|
|
||||||
comment: "ล้างมลทิน",
|
|
||||||
type: "text",
|
|
||||||
default: null,
|
|
||||||
})
|
|
||||||
unStigma: string;
|
|
||||||
|
|
||||||
@ManyToOne(
|
|
||||||
() => ProfileDisciplineEmployee,
|
|
||||||
(profileDiscipline) => profileDiscipline.profileDisciplineHistories,
|
|
||||||
)
|
|
||||||
@JoinColumn({ name: "profileDisciplineId" })
|
|
||||||
histories: ProfileDisciplineEmployee;
|
|
||||||
}
|
|
||||||
|
|
@ -4,7 +4,6 @@ import { EmployeePosLevel } from "./EmployeePosLevel";
|
||||||
import { EmployeePosType } from "./EmployeePosType";
|
import { EmployeePosType } from "./EmployeePosType";
|
||||||
import { EmployeePosMaster } from "./EmployeePosMaster";
|
import { EmployeePosMaster } from "./EmployeePosMaster";
|
||||||
import { ProfileSalaryEmployee } from "./ProfileSalaryEmployee";
|
import { ProfileSalaryEmployee } from "./ProfileSalaryEmployee";
|
||||||
import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee";
|
|
||||||
import { ProfileCertificate } from "./ProfileCertificate";
|
import { ProfileCertificate } from "./ProfileCertificate";
|
||||||
import { ProfileTraining } from "./ProfileTraining";
|
import { ProfileTraining } from "./ProfileTraining";
|
||||||
import { ProfileInsignia } from "./ProfileInsignia";
|
import { ProfileInsignia } from "./ProfileInsignia";
|
||||||
|
|
@ -19,8 +18,17 @@ import { ProfileChildren, ProfileFamilyHistory } from "./ProfileFamily";
|
||||||
import { ProfileEducation } from "./ProfileEducation";
|
import { ProfileEducation } from "./ProfileEducation";
|
||||||
import { ProfileAbility } from "./ProfileAbility";
|
import { ProfileAbility } from "./ProfileAbility";
|
||||||
import { ProfileOther } from "./ProfileOther";
|
import { ProfileOther } from "./ProfileOther";
|
||||||
|
import { ProfileAvatar } from "./ProfileAvatar";
|
||||||
|
import { ProfileGovernment } from "./ProfileGovernment";
|
||||||
@Entity("profileEmployee")
|
@Entity("profileEmployee")
|
||||||
export class ProfileEmployee extends EntityBase {
|
export class ProfileEmployee extends EntityBase {
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "รูปถ่าย",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
avatar: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ประเภทลูกจ้าง (perm->ลูกจ้างประจำ temp->ลูกจ้างชั่วคราว)",
|
comment: "ประเภทลูกจ้าง (perm->ลูกจ้างประจำ temp->ลูกจ้างชั่วคราว)",
|
||||||
|
|
@ -207,9 +215,6 @@ export class ProfileEmployee extends EntityBase {
|
||||||
@OneToMany(() => ProfileSalaryEmployee, (v) => v.profile)
|
@OneToMany(() => ProfileSalaryEmployee, (v) => v.profile)
|
||||||
profileSalary: ProfileSalaryEmployee[];
|
profileSalary: ProfileSalaryEmployee[];
|
||||||
|
|
||||||
@OneToMany(() => ProfileDisciplineEmployee, (v) => v.profile)
|
|
||||||
profileDiscipline: ProfileDisciplineEmployee[];
|
|
||||||
|
|
||||||
@OneToMany(() => ProfileCertificate, (v) => v.profileEmployee)
|
@OneToMany(() => ProfileCertificate, (v) => v.profileEmployee)
|
||||||
profileCertificates: ProfileCertificate[];
|
profileCertificates: ProfileCertificate[];
|
||||||
|
|
||||||
|
|
@ -235,7 +240,7 @@ export class ProfileEmployee extends EntityBase {
|
||||||
profileNopaids: ProfileNopaid[];
|
profileNopaids: ProfileNopaid[];
|
||||||
|
|
||||||
@OneToMany(() => ProfileDiscipline, (v) => v.profileEmployee)
|
@OneToMany(() => ProfileDiscipline, (v) => v.profileEmployee)
|
||||||
profileDisciplines: ProfileNopaid[];
|
profileDisciplines: ProfileDiscipline[];
|
||||||
|
|
||||||
@OneToMany(() => ProfileChangeName, (v) => v.profileEmployee)
|
@OneToMany(() => ProfileChangeName, (v) => v.profileEmployee)
|
||||||
profileChangeNames: ProfileChangeName[];
|
profileChangeNames: ProfileChangeName[];
|
||||||
|
|
@ -255,6 +260,9 @@ export class ProfileEmployee extends EntityBase {
|
||||||
@OneToMany(() => ProfileOther, (v) => v.profileEmployee)
|
@OneToMany(() => ProfileOther, (v) => v.profileEmployee)
|
||||||
profileOthers: ProfileOther[];
|
profileOthers: ProfileOther[];
|
||||||
|
|
||||||
|
@OneToMany(() => ProfileAvatar, (v) => v.profileEmployee)
|
||||||
|
profileAvatars: ProfileAvatar[];
|
||||||
|
|
||||||
@ManyToOne(() => EmployeePosLevel, (v) => v.profiles)
|
@ManyToOne(() => EmployeePosLevel, (v) => v.profiles)
|
||||||
posLevel: EmployeePosLevel;
|
posLevel: EmployeePosLevel;
|
||||||
|
|
||||||
|
|
@ -263,6 +271,9 @@ export class ProfileEmployee extends EntityBase {
|
||||||
|
|
||||||
@OneToMany(() => ProfileEmployeeHistory, (v) => v.profileEmployee)
|
@OneToMany(() => ProfileEmployeeHistory, (v) => v.profileEmployee)
|
||||||
histories: ProfileEmployeeHistory[];
|
histories: ProfileEmployeeHistory[];
|
||||||
|
|
||||||
|
@OneToMany(() => ProfileGovernment, (v) => v.profileEmployee)
|
||||||
|
profileGovernment: ProfileGovernment[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity("profileEmployeeHistory")
|
@Entity("profileEmployeeHistory")
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ export class ProfileGovernment extends EntityBase {
|
||||||
@JoinColumn({ name: "profileId" })
|
@JoinColumn({ name: "profileId" })
|
||||||
profile: Profile;
|
profile: Profile;
|
||||||
|
|
||||||
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileTrainings)
|
@ManyToOne(() => ProfileEmployee, (v) => v.profileGovernment)
|
||||||
@JoinColumn({ name: "profileEmployeeId" })
|
@JoinColumn({ name: "profileEmployeeId" })
|
||||||
profileEmployee: ProfileEmployee;
|
profileEmployee: ProfileEmployee;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -146,10 +146,6 @@ export class ProfileSalary extends EntityBase {
|
||||||
@ManyToOne(() => Profile, (profile) => profile.profileSalary)
|
@ManyToOne(() => Profile, (profile) => profile.profileSalary)
|
||||||
@JoinColumn({ name: "profileId" })
|
@JoinColumn({ name: "profileId" })
|
||||||
profile: Profile;
|
profile: Profile;
|
||||||
|
|
||||||
@ManyToOne(() => ProfileEmployee, (ProfileEmployee) => ProfileEmployee.profileSalary)
|
|
||||||
@JoinColumn({ name: "profileEmployeeId" })
|
|
||||||
profileEmployee: ProfileEmployee;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CreateProfileSalary {
|
export class CreateProfileSalary {
|
||||||
|
|
|
||||||
22
src/migration/1715673906573-update_table_node_add_duty1.ts
Normal file
22
src/migration/1715673906573-update_table_node_add_duty1.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableNodeAddDuty11715673906573 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableNodeAddDuty11715673906573'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`duty\` \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`duty\` \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ '`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`duty\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP COLUMN \`duty\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP COLUMN \`duty\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP COLUMN \`duty\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableNodeAddResponsibility1715675159227 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableNodeAddResponsibility1715675159227'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`duty\` \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`duty\` \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`duty\` \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`duty\` \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`duty\` \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`CREATE TABLE \`profileAvatar\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`avatar\` varchar(255) NULL COMMENT 'รูปถ่าย', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง Profile', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`avatar\` varchar(255) NULL COMMENT 'รูปถ่าย'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`avatar\` varchar(255) NULL COMMENT 'รูปถ่าย'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profile\` ADD \`avatar\` varchar(255) NULL COMMENT 'รูปถ่าย'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`avatar\` varchar(255) NULL COMMENT 'รูปถ่าย'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileAvatar\` ADD CONSTRAINT \`FK_e0db5c1a2f1facf02f03fbf78ea\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileAvatar\` ADD CONSTRAINT \`FK_fb52fa49388a6e73b41ba8259a3\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileAvatar\` DROP FOREIGN KEY \`FK_fb52fa49388a6e73b41ba8259a3\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileAvatar\` DROP FOREIGN KEY \`FK_e0db5c1a2f1facf02f03fbf78ea\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP COLUMN \`responsibility\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD \`responsibility\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`avatar\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`avatar\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`avatar\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`avatar\``);
|
||||||
|
await queryRunner.query(`DROP TABLE \`profileAvatar\``);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgRoot\` CHANGE \`responsibility\` \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild1\` CHANGE \`responsibility\` \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild2\` CHANGE \`responsibility\` \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild3\` CHANGE \`responsibility\` \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
await queryRunner.query(`ALTER TABLE \`orgChild4\` CHANGE \`responsibility\` \`duty\` varchar(255) NULL COMMENT 'หน้าที่ความรับผิดชอบ'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateTableNodeAddResponsibilit11715679161554 implements MigrationInterface {
|
||||||
|
name = 'UpdateTableNodeAddResponsibilit11715679161554'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_f5758428d496b6d2a051c8af92b\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_f5758428d496b6d2a051c8af92b\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue