update search
This commit is contained in:
parent
01cffa44aa
commit
dea1b11e1b
1 changed files with 31 additions and 29 deletions
|
|
@ -6161,8 +6161,8 @@ export class OrganizationDotnetController extends Controller {
|
||||||
where: {
|
where: {
|
||||||
...typeCondition,
|
...typeCondition,
|
||||||
createdAt: LessThanOrEqual(date),
|
createdAt: LessThanOrEqual(date),
|
||||||
firstName: Not("") && Not(IsNull()),
|
// firstName: Not("") && Not(IsNull()),
|
||||||
lastName: Not("") && Not(IsNull()),
|
// lastName: Not("") && Not(IsNull()),
|
||||||
},
|
},
|
||||||
order: {
|
order: {
|
||||||
firstName: "ASC",
|
firstName: "ASC",
|
||||||
|
|
@ -6171,10 +6171,10 @@ export class OrganizationDotnetController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
// group by firstName + lastName แล้วเลือก create_at ล่าสุด
|
// group by ancestorDNA แล้วเลือก create_at ล่าสุด
|
||||||
const grouped = new Map<string, PosMasterHistory>();
|
const grouped = new Map<string, PosMasterHistory>();
|
||||||
for (const item of profile) {
|
for (const item of profile) {
|
||||||
const key = `${item.firstName}-${item.lastName}`;
|
const key = `${item.ancestorDNA}`;
|
||||||
if (!grouped.has(key)) {
|
if (!grouped.has(key)) {
|
||||||
grouped.set(key, item);
|
grouped.set(key, item);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -6187,32 +6187,34 @@ export class OrganizationDotnetController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
const profile_ = await Promise.all(
|
const profile_ = await Promise.all(
|
||||||
Array.from(grouped.values()).map(async (item: PosMasterHistory) => {
|
Array.from(grouped.values())
|
||||||
let profile = await this.profileRepo.findOne({
|
.filter((x) => x.profileId != null)
|
||||||
where: { id: item.profileId },
|
.map(async (item: PosMasterHistory) => {
|
||||||
});
|
let profile = await this.profileRepo.findOne({
|
||||||
|
where: { id: item.profileId },
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: item.id,
|
id: item.id,
|
||||||
prefix: item.prefix,
|
prefix: item.prefix,
|
||||||
firstName: item.firstName,
|
firstName: item.firstName,
|
||||||
lastName: item.lastName,
|
lastName: item.lastName,
|
||||||
citizenId: profile?.citizenId ?? null,
|
citizenId: profile?.citizenId ?? null,
|
||||||
dateStart: profile?.dateStart ?? null,
|
dateStart: profile?.dateStart ?? null,
|
||||||
dateAppoint: profile?.dateAppoint ?? null,
|
dateAppoint: profile?.dateAppoint ?? null,
|
||||||
keycloak: profile?.keycloak ?? null,
|
keycloak: profile?.keycloak ?? null,
|
||||||
posNo: item.shortName,
|
posNo: item.shortName,
|
||||||
position: item.position,
|
position: item.position,
|
||||||
positionLevel: item.posLevel,
|
positionLevel: item.posLevel,
|
||||||
positionType: item.posType,
|
positionType: item.posType,
|
||||||
// oc: Oc,
|
// oc: Oc,
|
||||||
orgRootId: item.rootDnaId,
|
orgRootId: item.rootDnaId,
|
||||||
orgChild1Id: item.child1DnaId,
|
orgChild1Id: item.child1DnaId,
|
||||||
orgChild2Id: item.child2DnaId,
|
orgChild2Id: item.child2DnaId,
|
||||||
orgChild3Id: item.child3DnaId,
|
orgChild3Id: item.child3DnaId,
|
||||||
orgChild4Id: item.child4DnaId,
|
orgChild4Id: item.child4DnaId,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return new HttpSuccess(profile_);
|
return new HttpSuccess(profile_);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue