save profile before add his
This commit is contained in:
parent
577a413ffa
commit
f1436d1485
4 changed files with 25 additions and 24 deletions
|
|
@ -93,6 +93,7 @@ import { Gender } from "../entities/Gender";
|
||||||
import { ProfileAvatar } from "../entities/ProfileAvatar";
|
import { ProfileAvatar } from "../entities/ProfileAvatar";
|
||||||
import {
|
import {
|
||||||
CreatePosMasterHistoryEmployee,
|
CreatePosMasterHistoryEmployee,
|
||||||
|
CreatePosMasterHistoryEmployeeTemp,
|
||||||
CreatePosMasterHistoryOfficer,
|
CreatePosMasterHistoryOfficer,
|
||||||
} from "../services/PositionService";
|
} from "../services/PositionService";
|
||||||
@Route("api/v1/org/command")
|
@Route("api/v1/org/command")
|
||||||
|
|
@ -2175,8 +2176,7 @@ export class CommandController extends Controller {
|
||||||
command.isDraft = true;
|
command.isDraft = true;
|
||||||
command.isSign = true;
|
command.isSign = true;
|
||||||
command.status = "PENDING";
|
command.status = "PENDING";
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
command.status = "NEW";
|
command.status = "NEW";
|
||||||
}
|
}
|
||||||
command.issue = commandType.name;
|
command.issue = commandType.name;
|
||||||
|
|
@ -3171,6 +3171,7 @@ export class CommandController extends Controller {
|
||||||
await CreatePosMasterHistoryOfficer(posMasterOld.id, req);
|
await CreatePosMasterHistoryOfficer(posMasterOld.id, req);
|
||||||
}
|
}
|
||||||
await this.posMasterRepository.save(posMaster);
|
await this.posMasterRepository.save(posMaster);
|
||||||
|
await CreatePosMasterHistoryOfficer(posMaster.id, req);
|
||||||
|
|
||||||
const positionNew = await this.positionRepository.findOne({
|
const positionNew = await this.positionRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -3188,7 +3189,6 @@ export class CommandController extends Controller {
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
await this.positionRepository.save(positionNew);
|
await this.positionRepository.save(positionNew);
|
||||||
}
|
}
|
||||||
await CreatePosMasterHistoryOfficer(posMaster.id, req);
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -3363,6 +3363,7 @@ export class CommandController extends Controller {
|
||||||
await CreatePosMasterHistoryEmployee(posMasterOld.id, req);
|
await CreatePosMasterHistoryEmployee(posMasterOld.id, req);
|
||||||
}
|
}
|
||||||
await this.employeePosMasterRepository.save(posMaster);
|
await this.employeePosMasterRepository.save(posMaster);
|
||||||
|
await CreatePosMasterHistoryEmployee(posMaster.id, req);
|
||||||
const positionNew = await this.employeePositionRepository.findOne({
|
const positionNew = await this.employeePositionRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: item.positionId,
|
id: item.positionId,
|
||||||
|
|
@ -3381,7 +3382,6 @@ export class CommandController extends Controller {
|
||||||
await this.profileEmployeeRepository.save(profile);
|
await this.profileEmployeeRepository.save(profile);
|
||||||
await this.employeePositionRepository.save(positionNew);
|
await this.employeePositionRepository.save(positionNew);
|
||||||
}
|
}
|
||||||
await CreatePosMasterHistoryEmployee(posMaster.id, req);
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -6055,6 +6055,7 @@ export class CommandController extends Controller {
|
||||||
await CreatePosMasterHistoryOfficer(posMasterOld.id, req);
|
await CreatePosMasterHistoryOfficer(posMasterOld.id, req);
|
||||||
}
|
}
|
||||||
await this.posMasterRepository.save(posMaster);
|
await this.posMasterRepository.save(posMaster);
|
||||||
|
await CreatePosMasterHistoryOfficer(posMaster.id, req);
|
||||||
|
|
||||||
const positionNew = await this.positionRepository.findOne({
|
const positionNew = await this.positionRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -6072,7 +6073,6 @@ export class CommandController extends Controller {
|
||||||
setLogDataDiff(req, { before, after: profile });
|
setLogDataDiff(req, { before, after: profile });
|
||||||
await this.positionRepository.save(positionNew, { data: req });
|
await this.positionRepository.save(positionNew, { data: req });
|
||||||
}
|
}
|
||||||
await CreatePosMasterHistoryOfficer(posMaster.id, req);
|
|
||||||
}
|
}
|
||||||
// Insignia
|
// Insignia
|
||||||
if (_oldInsigniaIds.length > 0) {
|
if (_oldInsigniaIds.length > 0) {
|
||||||
|
|
@ -6440,6 +6440,7 @@ export class CommandController extends Controller {
|
||||||
await CreatePosMasterHistoryEmployee(posMasterOld.id, req);
|
await CreatePosMasterHistoryEmployee(posMasterOld.id, req);
|
||||||
}
|
}
|
||||||
await this.employeePosMasterRepository.save(posMaster);
|
await this.employeePosMasterRepository.save(posMaster);
|
||||||
|
await CreatePosMasterHistoryEmployee(posMaster.id, req);
|
||||||
|
|
||||||
const clsTempPosmaster = await this.employeeTempPosMasterRepository.find({
|
const clsTempPosmaster = await this.employeeTempPosMasterRepository.find({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -6568,7 +6569,6 @@ export class CommandController extends Controller {
|
||||||
});
|
});
|
||||||
await this.profileEmployeeRepository.save(profile);
|
await this.profileEmployeeRepository.save(profile);
|
||||||
await this.employeePositionRepository.save(positionNew);
|
await this.employeePositionRepository.save(positionNew);
|
||||||
await CreatePosMasterHistoryEmployee(posMaster.id, req);
|
|
||||||
//ลบออกคนออกจากโครงสร้างลูกจ้างชั่วคราว
|
//ลบออกคนออกจากโครงสร้างลูกจ้างชั่วคราว
|
||||||
const posMasterTemp = await this.employeeTempPosMasterRepository.findOne({
|
const posMasterTemp = await this.employeeTempPosMasterRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -6580,6 +6580,7 @@ export class CommandController extends Controller {
|
||||||
await this.employeeTempPosMasterRepository.update(posMasterTemp.id, {
|
await this.employeeTempPosMasterRepository.update(posMasterTemp.id, {
|
||||||
current_holderId: _null,
|
current_holderId: _null,
|
||||||
});
|
});
|
||||||
|
await CreatePosMasterHistoryEmployeeTemp(posMasterTemp.id, req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -2451,6 +2451,7 @@ export class EmployeePositionController extends Controller {
|
||||||
await CreatePosMasterHistoryEmployee(posMasterOld.id, request);
|
await CreatePosMasterHistoryEmployee(posMasterOld.id, request);
|
||||||
}
|
}
|
||||||
await this.employeePosMasterRepository.save(posMaster);
|
await this.employeePosMasterRepository.save(posMaster);
|
||||||
|
await CreatePosMasterHistoryEmployee(posMaster.id, request);
|
||||||
|
|
||||||
const positionNew = await this.employeePositionRepository.findOne({
|
const positionNew = await this.employeePositionRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -2471,7 +2472,6 @@ export class EmployeePositionController extends Controller {
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
await this.employeePositionRepository.save(positionNew);
|
await this.employeePositionRepository.save(positionNew);
|
||||||
}
|
}
|
||||||
await CreatePosMasterHistoryEmployee(posMaster.id, request);
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2187,6 +2187,7 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
await CreatePosMasterHistoryEmployeeTemp(posMasterOld.id, request);
|
await CreatePosMasterHistoryEmployeeTemp(posMasterOld.id, request);
|
||||||
}
|
}
|
||||||
await this.employeeTempPosMasterRepository.save(posMaster);
|
await this.employeeTempPosMasterRepository.save(posMaster);
|
||||||
|
await CreatePosMasterHistoryEmployeeTemp(posMaster.id, request);
|
||||||
|
|
||||||
const positionNew = await this.employeePositionRepository.findOne({
|
const positionNew = await this.employeePositionRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -2207,7 +2208,6 @@ export class EmployeeTempPositionController extends Controller {
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
await this.employeePositionRepository.save(positionNew);
|
await this.employeePositionRepository.save(positionNew);
|
||||||
}
|
}
|
||||||
await CreatePosMasterHistoryEmployeeTemp(posMaster.id, request);
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4088,16 +4088,16 @@ export class PositionController extends Controller {
|
||||||
posLevel = await this.posLevelRepository.find({
|
posLevel = await this.posLevelRepository.find({
|
||||||
where: {
|
where: {
|
||||||
posTypeId: In(posType.map((x: any) => x.id)),
|
posTypeId: In(posType.map((x: any) => x.id)),
|
||||||
posLevelName: In(["ทรงคุณวุฒิ", "สูง"])
|
posLevelName: In(["ทรงคุณวุฒิ", "สูง"]),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
conditionA = "positions.posTypeId IN (:...posTypeIds) AND positions.posLevelId IN (:...posLevelIds)";
|
conditionA =
|
||||||
|
"positions.posTypeId IN (:...posTypeIds) AND positions.posLevelId IN (:...posLevelIds)";
|
||||||
params = {
|
params = {
|
||||||
posTypeIds: posType.map((x: any) => x.id),
|
posTypeIds: posType.map((x: any) => x.id),
|
||||||
posLevelIds: posLevel.map((x: any) => x.id),
|
posLevelIds: posLevel.map((x: any) => x.id),
|
||||||
};
|
};
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
posType = await this.posTypeRepository.findOne({
|
posType = await this.posTypeRepository.findOne({
|
||||||
where: { id: String(body.posType) },
|
where: { id: String(body.posType) },
|
||||||
});
|
});
|
||||||
|
|
@ -4195,13 +4195,13 @@ export class PositionController extends Controller {
|
||||||
.andWhere(
|
.andWhere(
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.andWhere(typeCondition)
|
qb.andWhere(typeCondition)
|
||||||
// .andWhere(conditionA == null ? "1=1" : conditionA, {
|
// .andWhere(conditionA == null ? "1=1" : conditionA, {
|
||||||
// posType: posType == null ? `%%` : `${posType.id}`,
|
// posType: posType == null ? `%%` : `${posType.id}`,
|
||||||
// posLevel: posLevel == null ? `%%` : `${posLevel.id}`,
|
// posLevel: posLevel == null ? `%%` : `${posLevel.id}`,
|
||||||
// posTypeRank: posType == null ? 0 : posType.posTypeRank,
|
// posTypeRank: posType == null ? 0 : posType.posTypeRank,
|
||||||
// posLevelRank: posLevel == null ? 0 : posLevel.posLevelRank,
|
// posLevelRank: posLevel == null ? 0 : posLevel.posLevelRank,
|
||||||
// });
|
// });
|
||||||
.andWhere(conditionA, params);
|
.andWhere(conditionA, params);
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.orderBy("orgRoot.orgRootOrder", "ASC")
|
.orderBy("orgRoot.orgRootOrder", "ASC")
|
||||||
|
|
@ -4924,6 +4924,7 @@ export class PositionController extends Controller {
|
||||||
await CreatePosMasterHistoryOfficer(posMasterOld.id, request);
|
await CreatePosMasterHistoryOfficer(posMasterOld.id, request);
|
||||||
}
|
}
|
||||||
await this.posMasterRepository.save(posMaster);
|
await this.posMasterRepository.save(posMaster);
|
||||||
|
await CreatePosMasterHistoryOfficer(posMaster.id, request);
|
||||||
|
|
||||||
const positionNew = await this.positionRepository.findOne({
|
const positionNew = await this.positionRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
|
|
@ -4939,7 +4940,6 @@ export class PositionController extends Controller {
|
||||||
await this.profileRepository.save(profile);
|
await this.profileRepository.save(profile);
|
||||||
await this.positionRepository.save(positionNew);
|
await this.positionRepository.save(positionNew);
|
||||||
}
|
}
|
||||||
await CreatePosMasterHistoryOfficer(posMaster.id, request);
|
|
||||||
|
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue