edit type status profile

This commit is contained in:
kittapath 2025-01-27 10:23:28 +07:00
parent c60beef7e3
commit 9bf7ddf267
4 changed files with 39 additions and 15 deletions

View file

@ -26,6 +26,7 @@ import { Position } from "../entities/Position";
import { Insignia } from "../entities/Insignia";
import { CreateProfileInsignia, ProfileInsignia } from "../entities/ProfileInsignia";
import { PosMaster } from "../entities/PosMaster";
import { EmployeePosDict } from "../entities/EmployeePosDict";
@Route("api/v1/org/dotnet")
@Tags("Dotnet")
@ -43,6 +44,7 @@ export class OrganizationDotnetController extends Controller {
private positionRepository = AppDataSource.getRepository(Position);
private posMasterRepository = AppDataSource.getRepository(PosMaster);
private insigniaRepo = AppDataSource.getRepository(ProfileInsignia);
private employeePosDictRepository = AppDataSource.getRepository(EmployeePosDict);
/**
* 1. API Search Profile
@ -2366,11 +2368,15 @@ export class OrganizationDotnetController extends Controller {
@Body()
body: {
empPosId: string[];
rootId: string;
},
) {
const findRevision = await this.orgRevisionRepo.findOne({
where: { orgRevisionIsCurrent: true },
});
const employeePosDict = await this.employeePosDictRepository.find({
where: { id: In(body.empPosId) },
});
const profiles = await this.profileEmpRepo.find({
relations: [
@ -2387,12 +2393,12 @@ export class OrganizationDotnetController extends Controller {
"current_holders.orgChild3",
"current_holders.orgChild4",
],
where: {
current_holders: {
positions: { id: In(body.empPosId), positionIsSelected: true },
orgRevisionId: findRevision?.id,
},
},
where: employeePosDict.map((entry) => ({
posLevelId: entry.posLevelId,
posTypeId: entry.posTypeId,
position: entry.posDictName,
current_holders: { orgRootId: body.rootId },
})),
order: {
profileSalary: {
date: "DESC",