Merge branch 'develop' into adiDev

This commit is contained in:
AdisakKanthawilang 2024-05-14 17:25:38 +07:00
commit 40205a3a97
34 changed files with 442 additions and 326 deletions

View file

@ -222,7 +222,7 @@ export class ProfileController extends Controller {
@Request() request: RequestWithUser,
@Body() body: CreateProfileAllFields,
) {
const profileExist = await this.profileRepo.findOneBy({ citizenId: body.citizenId })
const profileExist = await this.profileRepo.findOneBy({ citizenId: body.citizenId });
if (profileExist) {
return new HttpSuccess(profileExist.id);
}
@ -759,11 +759,11 @@ export class ProfileController extends Controller {
? null
: profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id);
const position = await this.positionRepository.findOne({
const position = await this.positionRepository.findOne({
relations: ["posExecutive"],
where: {
posMasterId: posMaster?.id
}
where: {
posMasterId: posMaster?.id,
},
});
const _profile: any = {
@ -781,15 +781,16 @@ export class ProfileController extends Controller {
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
posTypeId: profile.posType == null ? null : profile.posType.id,
posExecutiveName: position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutiveName,
posExecutivePriority: position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutivePriority,
posExecutiveId: position == null || position.posExecutive == null
? null
: position.posExecutive.id,
posExecutiveName:
position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutiveName,
posExecutivePriority:
position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutivePriority,
posExecutiveId:
position == null || position.posExecutive == null ? null : position.posExecutive.id,
rootId:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == orgRevisionPublish.id)?.orgRoot ==
@ -1729,7 +1730,7 @@ export class ProfileController extends Controller {
.leftJoinAndSelect("posMaster.positions", "positions")
.leftJoinAndSelect("positions.posExecutive", "posExecutive")
.leftJoinAndSelect("current_holder.profileSalary", "profileSalary")
.leftJoinAndSelect("current_holder.profileDiscipline", "profileDiscipline")
.leftJoinAndSelect("current_holder.profileDisciplines", "profileDisciplines")
.leftJoinAndSelect("current_holder.posLevel", "posLevel")
.leftJoinAndSelect("current_holder.posType", "posType")
.where((qb) => {
@ -1890,7 +1891,7 @@ export class ProfileController extends Controller {
result: null,
duration: null,
isPunish:
item.current_holder.profileDiscipline.filter(
item.current_holder.profileDisciplines.filter(
(x: any) =>
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`,
@ -1937,14 +1938,14 @@ export class ProfileController extends Controller {
const posMaster = await this.posMasterRepo.findOne({
where: {
current_holderId: profile.id,
orgRevisionId: revisionId
}
orgRevisionId: revisionId,
},
});
const position = await this.positionRepository.findOne({
const position = await this.positionRepository.findOne({
relations: ["posExecutive"],
where: {
posMasterId: posMaster?.id
}
where: {
posMasterId: posMaster?.id,
},
});
const _profile = {
@ -1961,15 +1962,16 @@ export class ProfileController extends Controller {
posTypeName: profile.posType == null ? null : profile.posType.posTypeName,
posTypeRank: profile.posType == null ? null : profile.posType.posTypeRank,
posTypeId: profile.posType == null ? null : profile.posType.id,
posExecutiveName: position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutiveName,
posExecutivePriority: position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutivePriority,
posExecutiveId: position == null || position.posExecutive == null
? null
: position.posExecutive.id,
posExecutiveName:
position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutiveName,
posExecutivePriority:
position == null || position.posExecutive == null
? null
: position.posExecutive.posExecutivePriority,
posExecutiveId:
position == null || position.posExecutive == null ? null : position.posExecutive.id,
rootId:
profile.current_holders == null ||
profile.current_holders.find((x) => x.orgRevisionId == revisionId) == null ||