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

View file

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