no message

This commit is contained in:
kittapath 2024-11-11 18:04:21 +07:00
parent a87b03262d
commit 3724b2c0a6
3 changed files with 91 additions and 23 deletions

View file

@ -61,14 +61,8 @@ export class OrganizationController extends Controller {
@Get("history")
async GetHistory() {
const orgRevision = await this.orgRevisionRepository.find({
select: [
"id",
"orgRevisionName",
"orgRevisionIsCurrent",
"orgRevisionCreatedAt",
"orgRevisionIsDraft",
],
order: { orgRevisionCreatedAt: "DESC" },
select: ["id", "orgRevisionName", "orgRevisionIsCurrent", "createdAt", "orgRevisionIsDraft"],
order: { createdAt: "ASC" },
});
// if (!orgRevision) {
// return new HttpSuccess([]);
@ -77,7 +71,7 @@ export class OrganizationController extends Controller {
orgRevisionId: revision.id,
orgRevisionName: revision.orgRevisionName,
orgRevisionIsCurrent: revision.orgRevisionIsCurrent,
orgRevisionCreatedAt: revision.orgRevisionCreatedAt,
orgRevisionCreatedAt: revision.createdAt,
orgRevisionIsDraft: revision.orgRevisionIsDraft,
}));

View file

@ -269,12 +269,19 @@ export class OrganizationDotnetController extends Controller {
@Get("keycloak/{keycloakId}")
async GetProfileByKeycloakIdAsync(@Path() keycloakId: string) {
const profile = await this.profileRepo.findOne({
relations: {
posLevel: true,
posType: true,
profileSalary: true,
profileInsignias: true,
},
relations: [
"posLevel",
"posType",
"profileSalary",
"profileInsignias",
"current_holders",
"current_holders.orgRevision",
"current_holders.orgRoot",
"current_holders.orgChild1",
"current_holders.orgChild2",
"current_holders.orgChild3",
"current_holders.orgChild4",
],
where: { keycloak: keycloakId },
order: {
profileSalary: {
@ -287,12 +294,19 @@ export class OrganizationDotnetController extends Controller {
});
if (!profile) {
const profile = await this.profileEmpRepo.findOne({
relations: {
posLevel: true,
posType: true,
profileSalary: true,
profileInsignias: true,
},
relations: [
"posLevel",
"posType",
"profileSalary",
"profileInsignias",
"current_holders",
"current_holders.orgRevision",
"current_holders.orgRoot",
"current_holders.orgChild1",
"current_holders.orgChild2",
"current_holders.orgChild3",
"current_holders.orgChild4",
],
where: { keycloak: keycloakId },
order: {
profileSalary: {
@ -347,6 +361,36 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
root:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgRoot?.orgRootName ?? null,
child1:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild1?.orgChild1Name ?? null,
child2:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild2?.orgChild2Name ?? null,
child3:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild3?.orgChild3Name ?? null,
child4:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild4?.orgChild4Name ?? null,
posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,
@ -398,6 +442,36 @@ export class OrganizationDotnetController extends Controller {
currentZipCode: profile.currentZipCode,
dutyTimeId: profile.dutyTimeId,
dutyTimeEffectiveDate: profile.dutyTimeEffectiveDate,
root:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgRoot?.orgRootName ?? null,
child1:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild1?.orgChild1Name ?? null,
child2:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild2?.orgChild2Name ?? null,
child3:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild3?.orgChild3Name ?? null,
child4:
profile?.current_holders?.find(
(x) =>
x.orgRevision?.orgRevisionIsDraft == false &&
x.orgRevision?.orgRevisionIsCurrent == true,
)?.orgChild4?.orgChild4Name ?? null,
posLevel: profile.posLevel ? profile.posLevel : null,
posType: profile.posType ? profile.posType : null,
profileSalary: profile.profileSalary.length > 0 ? profile.profileSalary[0] : null,

View file

@ -866,7 +866,7 @@ export class ReportController extends Controller {
});
if (orgRevisionActive == null) {
const _orgRevisionActive = await this.orgRevisionRepository.find({
order: { orgRevisionCreatedAt: "DESC" },
order: { createdAt: "DESC" },
skip: 1,
relations: [
"posMasters",
@ -3033,7 +3033,7 @@ export class ReportController extends Controller {
});
if (orgRevisionActive == null) {
const _orgRevisionActive = await this.orgRevisionRepository.find({
order: { orgRevisionCreatedAt: "DESC" },
order: { createdAt: "DESC" },
skip: 1,
relations: [
"posMasters",