คนเข้าโครงสร้างแล้วปรับที่profile
This commit is contained in:
parent
85c6093970
commit
d85fffe082
2 changed files with 22 additions and 14 deletions
|
|
@ -2203,24 +2203,24 @@ export class EmployeePositionController extends Controller {
|
|||
const positionOld = await this.employeePositionRepository.findOne({
|
||||
where: {
|
||||
posMasterId: posMasterOld?.id,
|
||||
positionIsSelected: true
|
||||
}
|
||||
})
|
||||
positionIsSelected: true,
|
||||
},
|
||||
});
|
||||
if (positionOld != null) {
|
||||
positionOld.positionIsSelected = false
|
||||
positionOld.positionIsSelected = false;
|
||||
await this.employeePositionRepository.save(positionOld);
|
||||
}
|
||||
|
||||
const checkPosition = await this.employeePositionRepository.find({
|
||||
where: {
|
||||
posMasterId: body.posmasterId,
|
||||
positionIsSelected: true
|
||||
}
|
||||
})
|
||||
positionIsSelected: true,
|
||||
},
|
||||
});
|
||||
if (checkPosition.length > 0) {
|
||||
const clearPosition = checkPosition.map(positions => ({
|
||||
const clearPosition = checkPosition.map((positions) => ({
|
||||
...positions,
|
||||
positionIsSelected: false
|
||||
positionIsSelected: false,
|
||||
}));
|
||||
await this.employeePositionRepository.save(clearPosition);
|
||||
}
|
||||
|
|
@ -2239,11 +2239,15 @@ export class EmployeePositionController extends Controller {
|
|||
const positionNew = await this.employeePositionRepository.findOne({
|
||||
where: {
|
||||
id: body.positionId,
|
||||
posMasterId: body.posmasterId
|
||||
}
|
||||
})
|
||||
if(positionNew != null) {
|
||||
positionNew.positionIsSelected = true
|
||||
posMasterId: body.posmasterId,
|
||||
},
|
||||
});
|
||||
if (positionNew != null) {
|
||||
positionNew.positionIsSelected = true;
|
||||
profile.posLevel = positionNew.posLevel;
|
||||
profile.posType = positionNew.posType;
|
||||
profile.position = positionNew.positionName;
|
||||
await this.profileRepository.save(profile);
|
||||
await this.employeePositionRepository.save(positionNew);
|
||||
}
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
|
|
@ -3417,6 +3417,10 @@ export class PositionController extends Controller {
|
|||
});
|
||||
if (positionNew != null) {
|
||||
positionNew.positionIsSelected = true;
|
||||
profile.posLevel = positionNew.posLevel;
|
||||
profile.posType = positionNew.posType;
|
||||
profile.position = positionNew.positionName;
|
||||
await this.profileRepository.save(profile);
|
||||
await this.positionRepository.save(positionNew);
|
||||
}
|
||||
return new HttpSuccess();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue