Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop

This commit is contained in:
mamoss 2025-05-06 15:04:38 +07:00
commit 8c170f50c8
2 changed files with 48 additions and 31 deletions

View file

@ -3056,18 +3056,23 @@ export class OrganizationDotnetController extends Controller {
posExecutiveId:
position == null || position.posExecutive == null ? null : position.posExecutive.id,
rootId: root == null ? null : root.id,
rootDnaId: root == null ? null : root.ancestorDNA,
root: root == null ? null : root.orgRootName,
rootShortName: root == null ? null : root.orgRootShortName,
child1Id: child1 == null ? null : child1.id,
child1DnaId: child1 == null ? null : child1.ancestorDNA,
child1: child1 == null ? null : child1.orgChild1Name,
child1ShortName: child1 == null ? null : child1.orgChild1ShortName,
child2Id: child2 == null ? null : child2.id,
child2DnaId: child2 == null ? null : child2.ancestorDNA,
child2: child2 == null ? null : child2.orgChild2Name,
child2ShortName: child2 == null ? null : child2.orgChild2ShortName,
child3Id: child3 == null ? null : child3.id,
child3DnaId: child3 == null ? null : child3.ancestorDNA,
child3: child3 == null ? null : child3.orgChild3Name,
child3ShortName: child3 == null ? null : child3.orgChild3ShortName,
child4Id: child4 == null ? null : child4.id,
child4DnaId: child4 == null ? null : child4.ancestorDNA,
child4: child4 == null ? null : child4.orgChild4Name,
child4ShortName: child4 == null ? null : child4.orgChild4ShortName,
node: null,
@ -4216,17 +4221,19 @@ export class OrganizationDotnetController extends Controller {
const _position = position.length > 0 ? position[0] : [];
const mapEmpProfile = {
birthDate: profile.birthDate ?? null,
retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : null,
govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "",
age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "",
birthDate: profile.birthDate ?? "-",
retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-",
govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "-",
age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-",
dateAppoint: profile.dateAppoint,
amount: profile.amount,
telephoneNumber: profile.telephoneNumber ?? null,
positionName: profile.position,
dateCurrent: new Date(),
amount: profile.amount ?? "-",
telephoneNumber: profile.telephoneNumber ?? "-",
positionName: profile.position ?? "-",
posLevel: profile.posType && profile.posLevel
? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}` : null,
posType: profile.posType?.posTypeName ?? null,
? `${profile.posType?.posTypeShortName} ${profile.posLevel?.posLevelName}`
: "-",
posType: profile.posType?.posTypeName ?? "-",
currentAddress: profile && profile.currentAddress
? profile.currentAddress +
(profile.currentSubDistrict && profile.currentSubDistrict.name
@ -4236,8 +4243,8 @@ export class OrganizationDotnetController extends Controller {
(profile.currentProvince && profile.currentProvince.name
? " จังหวัด " + profile.currentProvince.name : "") +
profile.currentZipCode
: "",
oc: oc,
: "-",
oc: oc ?? "-",
root:
profile?.current_holders?.find(
(x) =>
@ -4269,9 +4276,12 @@ export class OrganizationDotnetController extends Controller {
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild4?.orgChild4Name ?? null,
positions: _position && _position.length > 0
? _position.map((x:any) => ({
? _position
.slice(0, -1)
.map((x:any, idx: number) => ({
positionName: x.positionName,
date: x.commandDateAffect,
dateStart: x.commandDateAffect ?? null,
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
positionType: x.positionType,
positionLevel: x.positionLevel,
orgRoot: x.orgRoot,
@ -4284,8 +4294,8 @@ export class OrganizationDotnetController extends Controller {
educations: profile.profileEducations && profile.profileEducations.length > 0
? profile.profileEducations.map(x => ({
educationLevel: x.educationLevel,
institute: x.institute,
country: x.country,
institute: x.institute ?? "-",
country: x.country ?? "-",
finishDate: x.finishDate,
}))
: []
@ -4315,16 +4325,17 @@ export class OrganizationDotnetController extends Controller {
const _position = position.length > 0 ? position[0] : [];
const mapProfile = {
birthDate: profile.birthDate ?? null,
retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : null,
govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "",
age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "",
birthDate: profile.birthDate ?? "-",
retireDate: profile.birthDate ? calculateRetireLaw(profile.birthDate) : "-",
govAge: profile.dateAppoint ? `${Extension.CalculateGovAge(profile.dateAppoint, 0, 0)} ปี` : "-",
age: profile.birthDate ? Extension.CalculateAgeStrV2(profile.birthDate, 0, 0) : "-",
dateAppoint: profile.dateAppoint,
amount: profile.amount,
telephoneNumber: profile.telephoneNumber ?? null,
positionName: profile.position,
posLevel: profile.posLevel?.posLevelName ?? null,
posType: profile.posType?.posTypeName ?? null,
dateCurrent: new Date(),
amount: profile.amount ?? "-",
telephoneNumber: profile.telephoneNumber ?? "-",
positionName: profile.position ?? "-",
posLevel: profile.posLevel?.posLevelName ?? "-",
posType: profile.posType?.posTypeName ?? "-",
currentAddress: profile && profile.currentAddress
? profile.currentAddress +
(profile.currentSubDistrict && profile.currentSubDistrict.name
@ -4334,8 +4345,8 @@ export class OrganizationDotnetController extends Controller {
(profile.currentProvince && profile.currentProvince.name
? " จังหวัด " + profile.currentProvince.name : "") +
profile.currentZipCode
: "",
oc: oc,
: "-",
oc: oc ?? "-",
root:
profile?.current_holders?.find(
(x) =>
@ -4367,9 +4378,12 @@ export class OrganizationDotnetController extends Controller {
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild4?.orgChild4Name ?? null,
positions: _position && _position.length > 0
? _position.map((x:any) => ({
? _position
.slice(0, -1)
.map((x:any, idx: number) => ({
positionName: x.positionName,
date: x.commandDateAffect,
dateStart: x.commandDateAffect ?? null,
dateEnd: _position[idx + 1]?.commandDateAffect ?? null,
positionType: x.positionType,
positionLevel: x.positionLevel,
orgRoot: x.orgRoot,
@ -4382,8 +4396,8 @@ export class OrganizationDotnetController extends Controller {
educations: profile.profileEducations && profile.profileEducations.length > 0
? profile.profileEducations.map(x => ({
educationLevel: x.educationLevel,
institute: x.institute,
country: x.country,
institute: x.institute ?? "-",
country: x.country ?? "-",
finishDate: x.finishDate,
}))
: []

View file

@ -133,7 +133,10 @@ export class ProfileLeaveController extends Controller {
await new permission().PermissionOrgUserGet(req, "SYS_REGISTRY_OFFICER", profileId);
const record = await this.leaveRepo.find({
relations: { leaveType: true },
where: { profileId: profileId, status: Not("cancel") },
where: {
profileId: profileId,
// status: Not("cancel")
},
order: { createdAt: "ASC" },
});
return new HttpSuccess(record);