This commit is contained in:
AdisakKanthawilang 2024-02-28 14:48:41 +07:00
parent 7531a9c582
commit bfae3e012d

View file

@ -79,7 +79,6 @@ export class OrganizationController extends Controller {
})); }));
return new HttpSuccess(mapOrgRevisions); return new HttpSuccess(mapOrgRevisions);
} }
/** /**
@ -106,7 +105,6 @@ export class OrganizationController extends Controller {
isPublic: orgRevisionDraf == null || orgRevisionDraf.orgRevisionName == null ? false : true, isPublic: orgRevisionDraf == null || orgRevisionDraf.orgRevisionName == null ? false : true,
}; };
return new HttpSuccess(mapData); return new HttpSuccess(mapData);
} }
/** /**
@ -511,9 +509,7 @@ export class OrganizationController extends Controller {
delete item.id; delete item.id;
const posMaster = Object.assign(new PosMaster(), item); const posMaster = Object.assign(new PosMaster(), item);
posMaster.positions = []; posMaster.positions = [];
if ( if (requestBody.typeDraft.toUpperCase() == "ORG_POSITION_PERSON") {
requestBody.typeDraft.toUpperCase() == "ORG_POSITION_PERSON"
) {
posMaster.next_holderId = item.current_holderId; posMaster.next_holderId = item.current_holderId;
} else { } else {
posMaster.next_holderId = null; posMaster.next_holderId = null;
@ -580,7 +576,6 @@ export class OrganizationController extends Controller {
await this.orgRevisionRepository.remove(_orgRevisions); await this.orgRevisionRepository.remove(_orgRevisions);
return new HttpSuccess(revision); return new HttpSuccess(revision);
} }
/** /**
@ -1166,8 +1161,7 @@ export class OrganizationController extends Controller {
current_holderId: Not(IsNull()) || Not(""), current_holderId: Not(IsNull()) || Not(""),
}, },
}), }),
totalPositionCurrentVacant: totalPositionCurrentVacant: await this.posMasterRepository.count({
await this.posMasterRepository.count({
where: { where: {
orgRevisionId: orgRoot.orgRevisionId, orgRevisionId: orgRoot.orgRevisionId,
orgChild4Id: orgChild4.id, orgChild4Id: orgChild4.id,
@ -1198,8 +1192,8 @@ export class OrganizationController extends Controller {
orgChild4Id: orgChild4.id, orgChild4Id: orgChild4.id,
}, },
}), }),
totalRootPositionCurrentUse: totalRootPositionCurrentUse: await this.posMasterRepository.count(
await this.posMasterRepository.count({ {
where: { where: {
orgRevisionId: orgRoot.orgRevisionId, orgRevisionId: orgRoot.orgRevisionId,
orgRootId: orgRoot.id, orgRootId: orgRoot.id,
@ -1209,7 +1203,8 @@ export class OrganizationController extends Controller {
orgChild4Id: orgChild4.id, orgChild4Id: orgChild4.id,
current_holderId: Not(IsNull()) || Not(""), current_holderId: Not(IsNull()) || Not(""),
}, },
}), },
),
totalRootPositionCurrentVacant: totalRootPositionCurrentVacant:
await this.posMasterRepository.count({ await this.posMasterRepository.count({
where: { where: {
@ -1233,8 +1228,8 @@ export class OrganizationController extends Controller {
next_holderId: Not(IsNull()) || Not(""), next_holderId: Not(IsNull()) || Not(""),
}, },
}), }),
totalRootPositionNextVacant: totalRootPositionNextVacant: await this.posMasterRepository.count(
await this.posMasterRepository.count({ {
where: { where: {
orgRevisionId: orgRoot.orgRevisionId, orgRevisionId: orgRoot.orgRevisionId,
orgRootId: orgRoot.id, orgRootId: orgRoot.id,
@ -1244,7 +1239,8 @@ export class OrganizationController extends Controller {
orgChild4Id: orgChild4.id, orgChild4Id: orgChild4.id,
next_holderId: IsNull() || "", next_holderId: IsNull() || "",
}, },
}), },
),
})), })),
), ),
})), })),
@ -1258,7 +1254,6 @@ export class OrganizationController extends Controller {
); );
return new HttpSuccess(formattedData); return new HttpSuccess(formattedData);
} }
/** /**
@ -1291,7 +1286,6 @@ export class OrganizationController extends Controller {
this.orgRevisionRepository.merge(orgRevision, requestBody); this.orgRevisionRepository.merge(orgRevision, requestBody);
await this.orgRevisionRepository.save(orgRevision); await this.orgRevisionRepository.save(orgRevision);
return new HttpSuccess(); return new HttpSuccess();
} }
/** /**
@ -1446,10 +1440,7 @@ export class OrganizationController extends Controller {
where: { id: requestBody.id }, where: { id: requestBody.id },
}); });
if (!revisionId?.id) { if (!revisionId?.id) {
throw new HttpError( throw new HttpError(HttpStatusCode.NOT_FOUND, "not found revisionId: " + requestBody.id);
HttpStatusCode.NOT_FOUND,
"not found revisionId: " + requestBody.id,
);
} }
const listRootId = await this.orgRootRepository.find({ const listRootId = await this.orgRootRepository.find({
where: { orgRevisionId: requestBody.id }, where: { orgRevisionId: requestBody.id },
@ -1550,7 +1541,6 @@ export class OrganizationController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found type: " + requestBody.type); throw new HttpError(HttpStatusCode.NOT_FOUND, "not found type: " + requestBody.type);
} }
return new HttpSuccess(); return new HttpSuccess();
} }
/** /**
@ -1919,8 +1909,7 @@ export class OrganizationController extends Controller {
deptID: orgChild4.id, deptID: orgChild4.id,
type: 5, type: 5,
// heads: // heads:
totalPositionCount: totalPositionCount: await this.posMasterRepository.count({
await this.posMasterRepository.count({
where: { where: {
orgRevisionId: data.id, orgRevisionId: data.id,
orgRootId: orgRoot.id, orgRootId: orgRoot.id,
@ -2739,7 +2728,6 @@ export class OrganizationController extends Controller {
default: default:
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found type: "); throw new HttpError(HttpStatusCode.NOT_FOUND, "not found type: ");
} }
} }
/** /**
@ -2805,7 +2793,6 @@ export class OrganizationController extends Controller {
default: default:
throw new HttpError(HttpStatusCode.NOT_FOUND, "not found type: " + requestBody.node); throw new HttpError(HttpStatusCode.NOT_FOUND, "not found type: " + requestBody.node);
} }
} }
/** /**
@ -2834,7 +2821,6 @@ export class OrganizationController extends Controller {
], ],
}); });
return new HttpSuccess(data); return new HttpSuccess(data);
} }
/** /**
@ -2856,7 +2842,6 @@ export class OrganizationController extends Controller {
where: { orgRevisionId: orgRevisionActive.id }, where: { orgRevisionId: orgRevisionActive.id },
}); });
return new HttpSuccess(data.map((x) => x.id)); return new HttpSuccess(data.map((x) => x.id));
} }
/** /**
@ -2878,7 +2863,6 @@ export class OrganizationController extends Controller {
], ],
}); });
return new HttpSuccess(data); return new HttpSuccess(data);
} }
/** /**
* API revision * API revision